// set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- $pdf->setFontSubsetting(true); $pdf->SetFont('arial', '', 10, '', true); $pdf->setRTL(false); // add a page $pdf->AddPage(); // set text shadow effect $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); //$text = "Filter: " . "Date From: " . $param[filter][dateFrom] . "; Date To: " . $param[filter][dateTo] . "; Approver: " . $param[filter][approver] . // "; Area: " . $param[filter][area] . "; Block: " . $param[filter][block] . "; Street: " . $param[filter][street] . "; PACI Number: " . $param[filter][paciNumber]; //$df = $param[filter][dateFrom]; $text = <<<EOD Filter: <br/> Date From: {$param[filter][dateFrom]}; Date To: {$param[filter][dateTo]} <br/> Approver: {$param[filter][approver]} <br/> Area: {$param[filter][area]}; Block: {$param[filter][block]}; Street: {$param[filter][street]}; PACI Number: {$param[filter][paciNumber]} EOD; // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $text, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true);
function creatNewPdf() { $agru = func_get_arg(0); $logo = $agru['logo']; $link = $agru['link']; $target = $agru['target']; $logoExtention = $agru['logo_extention']; $date = $agru['date']; $title = $agru['title']; $disc = $agru['description']; $image = $agru['image']; $content = $agru['content']; $copyright = $agru['copyright']; $fileName = $agru['file_name']; $pdfCreator = $agru['pdf_creator']; $pdfAuthor = $agru['pdf_author']; $pdfTitle = $agru['pdf_title']; $pdfSubject = $agru['pdf_subject']; $pdfKeywords = $agru['pdf_keywords']; // create new PDF document $pdf = new MYPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->setTempRTL('R'); $pdf->image_file = $logo; $pdf->href = $target; $pdf->link = $link; $pdf->copyright = $copyright; $this->extention = $logoExtention; # must included in each decument[Must Include] // appear in document properties $pdf->SetCreator($pdfCreator); $pdf->SetAuthor($pdfAuthor); $pdf->SetTitle($pdfTitle); $pdf->SetSubject($pdfSubject); $pdf->SetKeywords($pdfKeywords); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, ' ', ' ', array(0, 64, 255), array(0, 64, 128)); $pdf->setFooterData(array(0, 64, 0), array(0, 64, 128)); // 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)); // end of header # set default monospaced font[Must Include] $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); # set margins[Must Include] $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); // header & footer margin $pdf->SetHeaderMargin(50); $pdf->SetFooterMargin(20); $pdf->SetAutoPageBreak(TRUE, 30); $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $pdf->setFontSubsetting(true); //$pdf->SetFont('almohanad', '', 13); $pdf->setRTL(true); // cehck here if ar or en $pdf->startPageGroup(); $pdf->AddPage(); $lg = array(); $lg['a_meta_charset'] = 'UTF-8'; $lg['a_meta_dir'] = 'rtl'; $pdf->setLanguageArray($lg); $pdf->SetFont('almohanad', '', 13); $pdf->setRTL(true); // cehck here if ar or en $html = ' <div > <br/> <span id="date"style="color:#008080" > ' . $date . ' </span> <h3 id="title" style="color:#191970"> ' . $title . ' </h3> <h5 id="description" style="color:#6A5ACD"> ' . $disc . ' </h5> <img src="' . $image . '" alt="' . $title . '" /> <div style="align:justify"> ' . $content . ' </div> </div> '; // $pdf->writeHTML($html, true, false, false, true, ""); $pdf->writeHTMLCell($w = 170, $h = 0, $x = 0, $y = 0, $html, $border = 0, $ln = 0, $fill = false, $reseth = true, $align = "R"); $pdf->setRTL(true); #excute the file $pdf->Output(PDF_FILES . $fileName . '.pdf', 'F'); }
// set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- $pdf->setFontSubsetting(true); $pdf->SetFont('arial', '', 10, '', true); $pdf->setRTL(true); // add a page $pdf->AddPage(); // set text shadow effect $pdf->setTextShadow(array('enabled' => true, 'depth_w' => 0.2, 'depth_h' => 0.2, 'color' => array(196, 196, 196), 'opacity' => 1, 'blend_mode' => 'Normal')); $text = <<<EOD تم الاجتماع مع السيدة الفاضلة ممثلة إدارة محطات التمديدات الكهربائية وتضمن الاجتماع مناقشة النقاط التالية: EOD; //$html = include 'doc_text_01.txt'; //$text = file_get_contents("doc_text_02.txt"); //$text = mb_convert_encoding($text, "UTF-8"); // Print text using writeHTMLCell() $pdf->writeHTMLCell($w = 0, $h = 0, $x = '', $y = '', $text, $border = 0, $ln = 1, $fill = 0, $reseth = true, $align = '', $autopadding = true); $dt = array(); $ap = array(); if (is_string($res[0]->docHistory[0]->docDate)) {