• 0

سؤال في TCPDF - كيفية احتواء الخليه للنصوص warping text

سلام عليكم و رحمة الله

سؤال في مكتبة TCPDF

ازاي اخلي الخلية تحتوي النص ما يطلعش براها بالشكل ده ، احطلها خاصية warp text زي الاكسيل كده 

2021-06-10_16-40-17.jpg.8b228902d5abf6304635d5dcb6cd5900.jpg

 

الكود الخاص بي

 

<?php

include("includes/db.php");
include("includes/functions.php");
$title = "التقارير";

$order_id = $_GET['id'];

$uSql = "SELECT * FROM orders WHERE id='$order_id'";

if ($result = $conn->query($uSql)){

    $order = $result->fetch_assoc() ?? false;
    $result->free();

}
if (!$order){
    header("location: ./");
}

$date = $order['date'].'';
$date = explode(" ",$date);
$date = $date[0];

$query = "SELECT username, logo, qr FROM clients WHERE id=".$order['client_id']."";
$user = array();
if ($result = $conn->query($query)){

    $user = $result->fetch_assoc() ?? false;
    $result->free();
}
$client = $user['username'];
$logo = $user['logo'];
$qr = $user['qr'];

$query = "SELECT * FROM order_general_info WHERE id=".$order['general_info_id']."";
if ($result = $conn->query($query)){

    $info = $result->fetch_assoc() ?? false;
    $result->free();

}
$season = $info['season'];
$gender = $info['gender'];


$query = "SELECT name FROM models WHERE id=".$info['model_id']."";
$model = array();
if ($result = $conn->query($query)){

    $model = $result->fetch_assoc() ?? false;
    $result->free();

}
$model = $model['name'];


$query = "SELECT name FROM brands WHERE id=".$info['brand_id']."";
$brand = array();
if ($result = $conn->query($query)){

    $brand = $result->fetch_assoc() ?? false;
    $result->free();
}
$brand = $brand['name'];

$query = "SELECT m.image, d.name FROM order_model m JOIN design_sub_category d ON m.sub_design_id = d.id WHERE m.order_id=".$order['id']."";
$model_sub = array();
if ($result = $conn->query($query)){

    $model_sub = $result->fetch_assoc() ?? false;
    $result->free();
}
$model_image = $model_sub['image'];
$model_design_name = $model_sub['name'];


$query = "SELECT total_count, sample_size FROM patron WHERE id=".$order['patron_id']."";
$patron = array();
if ($result = $conn->query($query)){

    $patron = $result->fetch_assoc() ?? false;
    $result->free();
}
$total_count = $patron['total_count'];
$sample_size = $patron['sample_size'];

$query = "SELECT DISTINCT  title FROM size_table_sizes WHERE size_table_id=".$order['size_table_id'].";";
$size_table = array();
if ($result = $conn->query($query)){

    while ($row= $result->fetch_assoc()){

        array_push($size_table, $row) ;

    }
    $result->free();

}
$sizes = '';
foreach ($size_table as $k => $size){
    $sizes .= $size['title'] . ' - ';
    if ($k == count($size_table)-1)
        $sizes .= $size['title'];

}


$query = "SELECT DISTINCT cloth_composition_id FROM order_cloths WHERE order_id=".$order['id']." AND usage_id=15 ;";
$cloth_composition_id = array();
if ($result = $conn->query($query)){

    $cloth_composition_id = $result->fetch_assoc() ?? false;
    $result->free();

}
$cloth_composition_id = $cloth_composition_id['cloth_composition_id'];

$query = "SELECT c.mix, f.name FROM cloths_fabric c JOIN fibers f ON c.fiberT = f.id WHERE c.item=".$cloth_composition_id.";";
$clothes = array();
if ($result = $conn->query($query)){

    while ($row= $result->fetch_assoc()){

        array_push($clothes, $row) ;

    }
    $result->free();

}
$clothes_description = '';
foreach ($clothes as $k => $clothe){
    if ($k == count($clothes)-1)
        $clothes_description .= '('.$clothe['name'].': %'. $clothe['mix'] . ') ';
    else
    $clothes_description .= '('.$clothe['name'].': %'. $clothe['mix'] . ') - ';


}

$size_table = array();
$query = "SELECT * FROM size_table WHERE id=".$order['size_table_id']."";
if ($result = $conn->query($query)){

    $size_table = $result->fetch_assoc() ?? false;
    $result->free();

    $query = "SELECT * FROM size_table_factors WHERE size_table_id=".$order['size_table_id']."";
    $size_table_factors = array();

    if ($result = $conn->query($query)){

        while ($row= $result->fetch_assoc()){

            array_push($size_table_factors, $row) ;

        }
        $result->free();

        foreach ($size_table_factors as $k => $factor){

            $size_table_factors[$k]['sizes'] = array();

            $query = "SELECT * FROM size_table_sizes WHERE size_table_factor_id=".$factor['id']."";
            if ($result = $conn->query($query)){

                while ($row= $result->fetch_assoc()){

                    array_push($size_table_factors[$k]['sizes'], $row) ;

                }
                $result->free();

            }

        }

    }

}

//var_dump($size_table_factors); exit;



include('includes/tcpdf/tcpdf.php');

class MYPDF extends TCPDF {

    //Page header
    public function Header() {


    }

    // Page footer
    public function Footer() {
        $this->SetY(-15);
        $this->SetFont('tahoma', 'I', 6);
        $this->Cell(0, 10, 'Powered By GTMS - الريادة لنظم المعلومات', 0, false, 'C', 0, '', 0, false, 'T', 'M');
    }
}

$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);


// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP-22, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM-15);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language dependent data:
$lg = Array();
$lg['a_meta_charset'] = 'UTF-8';
$lg['a_meta_dir'] = 'rtl';
$lg['a_meta_language'] = 'fa';
$lg['w_page'] = 'page';

// set some language-dependent strings (optional)
$pdf->setLanguageArray($lg);

// ---------------------------------------------------------

// use the font
$pdf->SetFont('tahoma', '', 11, '', false);

// Restore RTL direction
$pdf->setRTL(true);

// add a page
$pdf->AddPage();

$pdf->SetLineStyle( array( 'width' => 1, 'color' => array(0,0,0)));

//$pdf->Line(0,0,$pdf->getPageWidth()-15,0);
$pdf->Line($pdf->getPageWidth()-15,5,$pdf->getPageWidth()-15,$pdf->getPageHeight()-27);
$pdf->Line(5,5,5,$pdf->getPageHeight()-27);



/* QR Line */
$pdf->SetFillColor(249, 219, 193);

$pdf->Cell(26,10,"رقم العقد",1,0,'C',1);
$pdf->Cell(24,10,$order_id,1,0,'C');

$pdf->Cell(26,10,"العميل",1,0,'C',1);
$pdf->Cell(32,10,$client,1,0,'C');

$pdf->Cell(26,10,"البراند",1,0,'C',1);
$pdf->Cell(26,10,$brand,1,1,'C');

$pdf->SetFillColor(193, 223, 249);

$pdf->Cell(26,10,"الموسم",1,0,'C',1);
$pdf->Cell(24,10,$season,1,0,'C');

$pdf->Cell(26,10,"التاريخ",1,0,'C',1);
$pdf->Cell(32,10,$date,1,0,'C');

$pdf->Cell(26,10,"مقاس العينة",1,0,'C',1);
$pdf->Cell(26,10,$sample_size,1,1,'C');

$pdf->SetFillColor(252, 229, 134);

$pdf->Cell(26,10,"النوع",1,0,'C',1);
$pdf->Cell(24,10,$gender,1,0,'C');

$pdf->Cell(26,10,"وصف المنتج",1,0,'C',1);
$pdf->Cell(84,10,$model_design_name,1,1,'C');

$pdf->Image('./assets/images/clients/'.$logo, 5, 5, 30, 30, '', '', 'J', false, 300, 'J', false, false, 1, true, false, false);


/* LOGO Line */
$pdf->Cell(26,10,"نوع القماش",1,0,'C',1);
$pdf->Cell(134,10,$clothes_description,1,1,'C');


$pdf->Cell(26,10,"المقاسات",1,0,'C',1);
$pdf->Cell(134,10,$sizes,1,1,'C');


$pdf->Cell(26,10,"عدد القطع",1,0,'C',1);
$pdf->Cell(50,10,$total_count,1,0,'C');

$pdf->Cell(30,10,"الموديل",1,0,'C',1);
$pdf->Cell(54,10,$model,1,1,'C');

$pdf->Image($qr, 5, 35, 30, 30, '', '', 'J', false, 300, 'J', false, false, 1, true, false, false);
$pdf->Ln(15);
// Header Ends

$pdf->SetFillColor(193, 223, 249);
$pdf->Cell(190, 12, 'جدول المقاسات', 1, 1, 'C', 1, '', 0, false, 'M', 'M');
$pdf->Ln(10);

//$this->Image($image_file, 'C', 6, '', '', 'JPG', false, 'C', false, 300, 'C', false, false, 0, false, false, false);

$pdf->Image('./assets/images/size_table/'.$size_table['image'], '', 100, $pdf->getPageWidth()/1.2, $pdf->getPageHeight()/2, '', '', 'C', false, 300, 'C', false, false, 1, true, false, false);
/* سطر الملاحظات */
$pdf->Ln();


$pdf->SetXY(15, $pdf->getPageHeight()-28);
$pdf->SetFont('tahoma', '', 12, '', false);

$pdf->Cell(55, 0, 'مسؤول التشغيل الخارجي', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(40, 0, '', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(55, 0, 'مسؤول التشغيل الفني', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(40, 0, '', 1, $ln=1, 'R', 0, '', 0, false, 'J', 'B');

$pdf->Cell(55, 0, 'التوقيع', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(40, 0, '', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(55, 0, 'التوقيع', 1, $ln=0, 'R', 0, '', 0, false, 'J', 'B');
$pdf->Cell(40, 0, '', 1, $ln=1, 'R', 0, '', 0, false, 'J', 'B');

// The Second Page


// Header Ends
$pdf->SetLineStyle( array( 'width' => 0.5, 'color' => array(0,0,0)));
$pdf->SetFont('tahoma', '', 10, '', false);
$pdf->SetFillColor(193, 223, 249);

$col_width = intval(143 / (count($size_table_factors[0]['sizes'])+1)) ;

foreach ($size_table_factors as $f => $factor){

        /* The Header */
    if ($f%13 == 0 || $f==0){

        $pdf->AddPage();

        $pdf->SetLineStyle( array( 'width' => 1, 'color' => array(0,0,0)));

        $pdf->Line($pdf->getPageWidth()-15,5,$pdf->getPageWidth()-15,$pdf->getPageHeight()-27);
        $pdf->Line(5,5,5,$pdf->getPageHeight()-27);


        // Header Starts
        /* QR Line */
        $pdf->SetFillColor(249, 219, 193);

        $pdf->Cell(26,10,"رقم العقد",1,0,'C',1);
        $pdf->Cell(24,10,$order_id,1,0,'C');

        $pdf->Cell(26,10,"العميل",1,0,'C',1);
        $pdf->Cell(32,10,$client,1,0,'C');

        $pdf->Cell(26,10,"البراند",1,0,'C',1);
        $pdf->Cell(26,10,$brand,1,1,'C');

        $pdf->SetFillColor(193, 223, 249);

        $pdf->Cell(26,10,"الموسم",1,0,'C',1);
        $pdf->Cell(24,10,$season,1,0,'C');

        $pdf->Cell(26,10,"التاريخ",1,0,'C',1);
        $pdf->Cell(32,10,$date,1,0,'C');

        $pdf->Cell(26,10,"مقاس العينة",1,0,'C',1);
        $pdf->Cell(26,10,$sample_size,1,1,'C');

        $pdf->SetFillColor(252, 229, 134);

        $pdf->Cell(26,10,"النوع",1,0,'C',1);
        $pdf->Cell(24,10,$gender,1,0,'C');

        $pdf->Cell(26,10,"وصف المنتج",1,0,'C',1);
        $pdf->Cell(84,10,$model_design_name,1,1,'C');

        $pdf->Image('./assets/images/clients/'.$logo, 5, 5, 30, 30, '', '', 'J', false, 300, 'J', false, false, 1, true, false, false);

        /* LOGO Line */
        $pdf->Cell(26,10,"نوع القماش",1,0,'C',1);
        $pdf->Cell(134,10,$clothes_description,1,1,'C');

        $pdf->Cell(26,10,"المقاسات",1,0,'C',1);
        $pdf->Cell(134,10,$sizes,1,1,'C');

        $pdf->Cell(26,10,"عدد القطع",1,0,'C',1);
        $pdf->Cell(50,10,$total_count,1,0,'C');

        $pdf->Cell(30,10,"الموديل",1,0,'C',1);
        $pdf->Cell(54,10,$model,1,1,'C');

        $pdf->Image($qr, 5, 35, 30, 30, '', '', 'J', false, 300, 'J', false, false, 1, true, false, false);
        $pdf->Ln(10);
        // Header Ends

        $pdf->SetFillColor(193, 223, 249);

        $pdf->Cell(47, 10, "عامل القياس", 1, 0, 'C', 1);

        $pdf->Cell($col_width, 10, "الرمز", 1, 0, 'C', 1);

        foreach ($size_table_factors[0]['sizes'] as $i => $size){

            if ($i == count($size_table_factors[0]['sizes'])-1){
                $pdf->Cell($col_width, 10, $size['title'], 1, 1, 'C', 1);

            } else {
                $pdf->Cell($col_width, 10, $size['title'], 1, 0, 'C', 1);
            }


        }

    }

    $pdf->Cell(47, 10, $factor['factor'], 1, 0, 'C', 1);
    $pdf->Cell($col_width, 10, $factor['code'], 1, 0, 'C', 1);

    foreach ($factor['sizes'] as $s => $size) {

        if ($s == count($factor['sizes'])-1){
            $pdf->Cell($col_width, 10, $size['value'], 1, 1, 'C', 0);

        } else {
            $pdf->Cell($col_width, 10, $size['value'], 1, 0, 'C', 0);
        }


    }

        /* The Footer*/
    if ($f%13 == 12 || $f== sizeof($size_table_factors)-1 ) {

        // Footer
        $pdf->SetXY(15, $pdf->getPageHeight() - 28);
        $pdf->SetFont('tahoma', '', 12, '', false);

        $pdf->Cell(55, 0, 'مسؤول التشغيل الخارجي', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(40, 0, '', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(55, 0, 'مسؤول التشغيل الفني', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(40, 0, '', 1, $ln = 1, 'R', 0, '', 0, false, 'J', 'B');

        $pdf->Cell(55, 0, 'التوقيع', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(40, 0, '', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(55, 0, 'التوقيع', 1, $ln = 0, 'R', 0, '', 0, false, 'J', 'B');
        $pdf->Cell(40, 0, '', 1, $ln = 1, 'R', 0, '', 0, false, 'J', 'B');
    }

}



//Close and output PDF document
$pdf->Output('size_table_report.pdf', 'I');

//============================================================+
// END OF FILE

 

size_table_report.pdf

1 شخص أعجب بهذا

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية
  • 1

يمكنك استخدام Multicell لتقوم بالتفاف النصوص 

$pdf->MultiCell(55, 5, [LEFT]'.$text, 1, 1, 0, '', '', true);

يمكنك مراجعة التوثيق الخاص بالمكتبة من هنا للقراءة أكثر عن MultiCell. 

انشر على الشّبكات الاجتماعية


رابط هذه المساهمة
شارك على الشبكات الإجتماعية

يجب أن تكون عضوًا لدينا لتتمكّن من التعليق

انشاء حساب جديد

يستغرق التسجيل بضع ثوان فقط


سجّل حسابًا جديدًا

تسجيل الدخول

تملك حسابا مسجّلا بالفعل؟


سجّل دخولك الآن