1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
|
|
require_once('tcpdf_include.php');
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
32 |
|
|
|
33 |
|
|
|
34 |
|
|
$pdf->SetCreator(PDF_CREATOR);
|
35 |
|
|
$pdf->SetAuthor('Nicola Asuni');
|
36 |
|
|
$pdf->SetTitle('TCPDF Example 018');
|
37 |
|
|
$pdf->SetSubject('TCPDF Tutorial');
|
38 |
|
|
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING);
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
|
45 |
|
|
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
|
52 |
|
|
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
|
53 |
|
|
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
$lg = Array();
|
63 |
|
|
$lg['a_meta_charset'] = 'UTF-8';
|
64 |
|
|
$lg['a_meta_dir'] = 'rtl';
|
65 |
|
|
$lg['a_meta_language'] = 'fa';
|
66 |
|
|
$lg['w_page'] = 'page';
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
$pdf->setLanguageArray($lg);
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
$pdf->SetFont('dejavusans', '', 12);
|
75 |
|
|
|
76 |
|
|
|
77 |
|
|
$pdf->AddPage();
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
$htmlpersian = '<span color="#660000">Persian example:</span><br />سلام بالاخره مشکل PDF فارسی به طور کامل حل شد. اینم یک نمونش.<br />مشکل حرف \"ژ\" در بعضی کلمات مانند کلمه ویژه نیز بر طرف شد.<br />نگارش حروف لام و الف پشت سر هم نیز تصحیح شد.<br />با تشکر از "Asuni Nicola" و محمد علی گل کار برای پشتیبانی زبان فارسی.';
|
81 |
|
|
$pdf->WriteHTML($htmlpersian, true, 0, true, 0);
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
$pdf->setRTL(false);
|
85 |
|
|
|
86 |
|
|
$pdf->SetFontSize(10);
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
$pdf->Ln();
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
$htmlpersiantranslation = '<span color="#0000ff">Hi, At last Problem of Persian PDF Solved completely. This is a example for it.<br />Problem of "jeh" letter in some word like "ویژه" (=special) fix too.<br />The joining of laa and alf letter fix now.<br />Special thanks to "Nicola Asuni" and "Mohamad Ali Golkar" for Persian support.</span>';
|
93 |
|
|
$pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
$pdf->setRTL(true);
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
$pdf->SetFont('aefurat', '', 18);
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
$pdf->Ln();
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
$pdf->Cell(0, 12, 'بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ',0,1,'C');
|
106 |
|
|
$htmlcontent = 'تمَّ بِحمد الله حلّ مشكلة الكتابة باللغة العربية في ملفات الـ<span color="#FF0000">PDF</span> مع دعم الكتابة <span color="#0000FF">من اليمين إلى اليسار</span> و<span color="#009900">الحركَات</span> .<br />تم الحل بواسطة <span color="#993399">صالح المطرفي و Asuni Nicola</span> . ';
|
107 |
|
|
$pdf->WriteHTML($htmlcontent, true, 0, true, 0);
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
$pdf->setRTL(false);
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
$pdf->Ln();
|
114 |
|
|
|
115 |
|
|
$pdf->SetFont('aealarabiya', '', 18);
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
$htmlcontent2 = '<span color="#0000ff">This is Arabic "العربية" Example With TCPDF.</span>';
|
119 |
|
|
$pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
|
120 |
|
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
$pdf->Output('example_018.pdf', 'I');
|
125 |
|
|
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
|