--- a/tcpdf/examples/example_018.php +++ b/tcpdf/examples/example_018.php @@ -1,1 +1,133 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 018'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING); + +// 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, 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 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 +$pdf->setLanguageArray($lg); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('dejavusans', '', 12); + +// add a page +$pdf->AddPage(); + +// Persian and English content +$htmlpersian = 'Persian example:
سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.
مشکل حرف \"ژ\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.
نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.
با تشکر از "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.'; +$pdf->WriteHTML($htmlpersian, true, 0, true, 0); + +// set LTR direction for english translation +$pdf->setRTL(false); + +$pdf->SetFontSize(10); + +// print newline +$pdf->Ln(); + +// Persian and English content +$htmlpersiantranslation = 'Hi, At last Problem of Persian PDF Solved completely. This is a example for it.
Problem of "jeh" letter in some word like "ویژه" (=special) fix too.
The joining of laa and alf letter fix now.
Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.
'; +$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0); + +// Restore RTL direction +$pdf->setRTL(true); + +// set font size +$pdf->SetFont('almohanad', '', 18); + +// print newline +$pdf->Ln(); + +// Arabic and English content +$pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C'); +$htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـPDF مع دعم الكتابة من اليمين إلى اليسار والحركَات .
تم الحل بواسطة صالح المطرفي و Asuni Nicola . '; +$pdf->WriteHTML($htmlcontent, true, 0, true, 0); + +// set LTR direction for english translation +$pdf->setRTL(false); + +// set font size +$pdf->SetFontSize(18); + +// print newline +$pdf->Ln(); + +// Arabic and English content +$htmlcontent2 = 'This is Arabic "العربية" Example With TCPDF.'; +$pdf->WriteHTML($htmlcontent2, true, 0, true, 0); + +// --------------------------------------------------------- + +//Close and output PDF document +$pdf->Output('example_018.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ +