PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.13.1
GiveWP – Donation Plugin and Fundraising Platform v4.13.1
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / vendor / tecnickcom / tcpdf / examples / example_018.php
example_018.php
157 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 //============================================================+
3 // File name : example_018.php
4 // Begin : 2008-03-06
5 // Last Update : 2013-05-14
6 //
7 // Description : Example 018 for TCPDF class
8 // RTL document with Persian language
9 //
10 // Author: Nicola Asuni
11 //
12 // (c) Copyright:
13 // Nicola Asuni
14 // Tecnick.com LTD
15 // www.tecnick.com
16 // info@tecnick.com
17 //============================================================+
18
19 /**
20 * Creates an example PDF TEST document using TCPDF
21 * @package com.tecnick.tcpdf
22 * @abstract TCPDF - Example: RTL document with Persian language
23 * @author Nicola Asuni
24 * @since 2008-03-06
25 * @group rtl
26 * @group pdf
27 */
28
29 // Include the main TCPDF library (search for installation path).
30 require_once('tcpdf_include.php');
31
32 // create new PDF document
33 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
34
35 // set document information
36 $pdf->setCreator(PDF_CREATOR);
37 $pdf->setAuthor('Nicola Asuni');
38 $pdf->setTitle('TCPDF Example 018');
39 $pdf->setSubject('TCPDF Tutorial');
40 $pdf->setKeywords('TCPDF, PDF, example, test, guide');
41
42 // set default header data
43 $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING);
44
45 // set header and footer fonts
46 $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
47 $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
48
49 // set default monospaced font
50 $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
51
52 // set margins
53 $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
54 $pdf->setHeaderMargin(PDF_MARGIN_HEADER);
55 $pdf->setFooterMargin(PDF_MARGIN_FOOTER);
56
57 // set auto page breaks
58 $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
59
60 // set image scale factor
61 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
62
63 // set some language dependent data:
64 $lg = Array();
65 $lg['a_meta_charset'] = 'UTF-8';
66 $lg['a_meta_dir'] = 'rtl';
67 $lg['a_meta_language'] = 'fa';
68 $lg['w_page'] = 'page';
69
70 // set some language-dependent strings (optional)
71 $pdf->setLanguageArray($lg);
72
73 // ---------------------------------------------------------
74
75 // set font
76 $pdf->setFont('dejavusans', '', 12);
77
78 // add a page
79 $pdf->AddPage();
80
81 // Persian and English content
82 $htmlpersian = '<span color="#660000">Persian example:</span><br />سلا�
83 بالاخره �
84 شکل PDF فارسی به طور کا�
85 ل حل شد. این�
86 یک ن�
87 ونش.<br />�
88 شکل حرف \"ژ\" در بعضی کل�
89 ات �
90 انند کل�
91 ه ویژه نیز بر طرف شد.<br />نگارش حروف لا�
92 و الف پشت سر ه�
93 نیز تصحیح شد.<br />با تشکر از "Asuni Nicola" و �
94 ح�
95 د علی گل کار برای پشتیبانی زبان فارسی.';
96 $pdf->WriteHTML($htmlpersian, true, 0, true, 0);
97
98 // set LTR direction for english translation
99 $pdf->setRTL(false);
100
101 $pdf->setFontSize(10);
102
103 // print newline
104 $pdf->Ln();
105
106 // Persian and English content
107 $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>';
108 $pdf->WriteHTML($htmlpersiantranslation, true, 0, true, 0);
109
110 // Restore RTL direction
111 $pdf->setRTL(true);
112
113 // set font
114 $pdf->setFont('aefurat', '', 18);
115
116 // print newline
117 $pdf->Ln();
118
119 // Arabic and English content
120 $pdf->Cell(0, 12, 'بِسْ�
121 ِ اللهِ الرَّحْ�
122 نِ الرَّحِي�
123 ِ',0,1,'C');
124 $htmlcontent = 'ت�
125 َّ بِح�
126 د الله حلّ �
127 شكلة الكتابة باللغة العربية في �
128 لفات الـ<span color="#FF0000">PDF</span> �
129 ع دع�
130 الكتابة <span color="#0000FF">�
131 ن الي�
132 ين إلى اليسار</span> و<span color="#009900">الحركَات</span> .<br />ت�
133 الحل بواسطة <span color="#993399">صالح ال�
134 طرفي و Asuni Nicola</span> . ';
135 $pdf->WriteHTML($htmlcontent, true, 0, true, 0);
136
137 // set LTR direction for english translation
138 $pdf->setRTL(false);
139
140 // print newline
141 $pdf->Ln();
142
143 $pdf->setFont('aealarabiya', '', 18);
144
145 // Arabic and English content
146 $htmlcontent2 = '<span color="#0000ff">This is Arabic "العربية" Example With TCPDF.</span>';
147 $pdf->WriteHTML($htmlcontent2, true, 0, true, 0);
148
149 // ---------------------------------------------------------
150
151 //Close and output PDF document
152 $pdf->Output('example_018.pdf', 'I');
153
154 //============================================================+
155 // END OF FILE
156 //============================================================+
157