PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.24.0
GiveWP – Donation Plugin and Fundraising Platform v2.24.0
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 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / vendor / tecnickcom / tcpdf / examples / example_006.php
give / vendor / tecnickcom / tcpdf / examples Last commit date
barcodes 4 years ago config 5 years ago data 5 years ago images 5 years ago lang 5 years ago example_001.php 5 years ago example_002.php 5 years ago example_003.php 5 years ago example_004.php 5 years ago example_005.php 5 years ago example_006.php 5 years ago example_007.php 5 years ago example_008.php 5 years ago example_009.php 5 years ago example_010.php 4 years ago example_011.php 5 years ago example_012.pdf 5 years ago example_012.php 5 years ago example_013.php 5 years ago example_014.php 5 years ago example_015.php 5 years ago example_016.php 5 years ago example_017.php 5 years ago example_018.php 5 years ago example_019.php 5 years ago example_020.php 5 years ago example_021.php 5 years ago example_022.php 5 years ago example_023.php 5 years ago example_024.php 5 years ago example_025.php 5 years ago example_026.php 5 years ago example_027.php 5 years ago example_028.php 5 years ago example_029.php 5 years ago example_030.php 5 years ago example_031.php 5 years ago example_032.php 5 years ago example_033.php 5 years ago example_034.php 5 years ago example_035.php 5 years ago example_036.php 5 years ago example_037.php 5 years ago example_038.php 5 years ago example_039.php 5 years ago example_040.php 5 years ago example_041.php 5 years ago example_042.php 5 years ago example_043.php 5 years ago example_044.php 5 years ago example_045.php 5 years ago example_046.php 5 years ago example_047.php 5 years ago example_048.php 5 years ago example_049.php 5 years ago example_050.php 5 years ago example_051.php 5 years ago example_052.php 5 years ago example_053.php 5 years ago example_054.php 5 years ago example_055.php 5 years ago example_056.php 5 years ago example_057.php 5 years ago example_058.php 5 years ago example_059.php 5 years ago example_060.php 5 years ago example_061.php 5 years ago example_062.php 5 years ago example_063.php 5 years ago example_064.php 5 years ago example_065.php 5 years ago example_066.php 4 years ago index.php 5 years ago tcpdf_include.php 5 years ago
example_006.php
331 lines
1 <?php
2 //============================================================+
3 // File name : example_006.php
4 // Begin : 2008-03-04
5 // Last Update : 2013-05-14
6 //
7 // Description : Example 006 for TCPDF class
8 // WriteHTML and RTL support
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: WriteHTML and RTL support
23 * @author Nicola Asuni
24 * @since 2008-03-04
25 */
26
27 // Include the main TCPDF library (search for installation path).
28 require_once('tcpdf_include.php');
29
30 // create new PDF document
31 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
32
33 // set document information
34 $pdf->SetCreator(PDF_CREATOR);
35 $pdf->SetAuthor('Nicola Asuni');
36 $pdf->SetTitle('TCPDF Example 006');
37 $pdf->SetSubject('TCPDF Tutorial');
38 $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
39
40 // set default header data
41 $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING);
42
43 // set header and footer fonts
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 // set default monospaced font
48 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
49
50 // set margins
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 // set auto page breaks
56 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
57
58 // set image scale factor
59 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
60
61 // set some language-dependent strings (optional)
62 if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
63 require_once(dirname(__FILE__).'/lang/eng.php');
64 $pdf->setLanguageArray($l);
65 }
66
67 // ---------------------------------------------------------
68
69 // set font
70 $pdf->SetFont('dejavusans', '', 10);
71
72 // add a page
73 $pdf->AddPage();
74
75 // writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
76 // writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
77
78 // create some HTML content
79 $html = '<h1>HTML Example</h1>
80 Some special characters: &lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt; \\slash \\\\double-slash \\\\\\triple-slash
81 <h2>List</h2>
82 List example:
83 <ol>
84 <li><img src="images/logo_example.png" alt="test alt attribute" width="30" height="30" border="0" /> test image</li>
85 <li><b>bold text</b></li>
86 <li><i>italic text</i></li>
87 <li><u>underlined text</u></li>
88 <li><b>b<i>bi<u>biu</u>bi</i>b</b></li>
89 <li><a href="http://www.tecnick.com" dir="ltr">link to http://www.tecnick.com</a></li>
90 <li>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.<br />Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.</li>
91 <li>SUBLIST
92 <ol>
93 <li>row one
94 <ul>
95 <li>sublist</li>
96 </ul>
97 </li>
98 <li>row two</li>
99 </ol>
100 </li>
101 <li><b>T</b>E<i>S</i><u>T</u> <del>line through</del></li>
102 <li><font size="+3">font + 3</font></li>
103 <li><small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal</li>
104 </ol>
105 <dl>
106 <dt>Coffee</dt>
107 <dd>Black hot drink</dd>
108 <dt>Milk</dt>
109 <dd>White cold drink</dd>
110 </dl>
111 <div style="text-align:center">IMAGES<br />
112 <img src="images/logo_example.png" alt="test alt attribute" width="100" height="100" border="0" /><img src="images/tcpdf_box.svg" alt="test alt attribute" width="100" height="100" border="0" /><img src="images/logo_example.jpg" alt="test alt attribute" width="100" height="100" border="0" />
113 </div>';
114
115 // output the HTML content
116 $pdf->writeHTML($html, true, false, true, false, '');
117
118
119 // output some RTL HTML content
120 $html = '<div style="text-align:center">The words &#8220;<span dir="rtl">&#1502;&#1494;&#1500; [mazel] &#1496;&#1493;&#1489; [tov]</span>&#8221; mean &#8220;Congratulations!&#8221;</div>';
121 $pdf->writeHTML($html, true, false, true, false, '');
122
123 // test some inline CSS
124 $html = '<p>This is just an example of html code to demonstrate some supported CSS inline styles.
125 <span style="font-weight: bold;">bold text</span>
126 <span style="text-decoration: line-through;">line-trough</span>
127 <span style="text-decoration: underline line-through;">underline and line-trough</span>
128 <span style="color: rgb(0, 128, 64);">color</span>
129 <span style="background-color: rgb(255, 0, 0); color: rgb(255, 255, 255);">background color</span>
130 <span style="font-weight: bold;">bold</span>
131 <span style="font-size: xx-small;">xx-small</span>
132 <span style="font-size: x-small;">x-small</span>
133 <span style="font-size: small;">small</span>
134 <span style="font-size: medium;">medium</span>
135 <span style="font-size: large;">large</span>
136 <span style="font-size: x-large;">x-large</span>
137 <span style="font-size: xx-large;">xx-large</span>
138 </p>';
139
140 $pdf->writeHTML($html, true, false, true, false, '');
141
142 // reset pointer to the last page
143 $pdf->lastPage();
144
145 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
146 // Print a table
147
148 // add a page
149 $pdf->AddPage();
150
151 // create some HTML content
152 $subtable = '<table border="1" cellspacing="6" cellpadding="4"><tr><td>a</td><td>b</td></tr><tr><td>c</td><td>d</td></tr></table>';
153
154 $html = '<h2>HTML TABLE:</h2>
155 <table border="1" cellspacing="3" cellpadding="4">
156 <tr>
157 <th>#</th>
158 <th align="right">RIGHT align</th>
159 <th align="left">LEFT align</th>
160 <th>4A</th>
161 </tr>
162 <tr>
163 <td>1</td>
164 <td bgcolor="#cccccc" align="center" colspan="2">A1 ex<i>amp</i>le <a href="http://www.tcpdf.org">link</a> column span. One two tree four five six seven eight nine ten.<br />line after br<br /><small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla<ol><li>first<ol><li>sublist</li><li>sublist</li></ol></li><li>second</li></ol><small color="#FF0000" bgcolor="#FFFF00">small small small small small small small small small small small small small small small small small small small small</small></td>
165 <td>4B</td>
166 </tr>
167 <tr>
168 <td>'.$subtable.'</td>
169 <td bgcolor="#0000FF" color="yellow" align="center">A2 € &euro; &#8364; &amp; è &egrave;<br/>A2 € &euro; &#8364; &amp; è &egrave;</td>
170 <td bgcolor="#FFFF00" align="left"><font color="#FF0000">Red</font> Yellow BG</td>
171 <td>4C</td>
172 </tr>
173 <tr>
174 <td>1A</td>
175 <td rowspan="2" colspan="2" bgcolor="#FFFFCC">2AA<br />2AB<br />2AC</td>
176 <td bgcolor="#FF0000">4D</td>
177 </tr>
178 <tr>
179 <td>1B</td>
180 <td>4E</td>
181 </tr>
182 <tr>
183 <td>1C</td>
184 <td>2C</td>
185 <td>3C</td>
186 <td>4F</td>
187 </tr>
188 </table>';
189
190 // output the HTML content
191 $pdf->writeHTML($html, true, false, true, false, '');
192
193 // Print some HTML Cells
194
195 $html = '<span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span><br /><span color="red">red</span> <span color="green">green</span> <span color="blue">blue</span>';
196
197 $pdf->SetFillColor(255,255,0);
198
199 $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true);
200 $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true);
201 $pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true);
202
203 // reset pointer to the last page
204 $pdf->lastPage();
205
206 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
207 // Print a table
208
209 // add a page
210 $pdf->AddPage();
211
212 // create some HTML content
213 $html = '<h1>Image alignments on HTML table</h1>
214 <table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
215 <tr><td><img src="images/logo_example.png" border="0" height="41" width="41" /></td></tr>
216 <tr style="text-align:left;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr>
217 <tr style="text-align:center;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr>
218 <tr style="text-align:right;"><td><img src="images/logo_example.png" border="0" height="41" width="41" align="bottom" /></td></tr>
219 <tr><td style="text-align:left;"><img src="images/logo_example.png" border="0" height="41" width="41" align="top" /></td></tr>
220 <tr><td style="text-align:center;"><img src="images/logo_example.png" border="0" height="41" width="41" align="middle" /></td></tr>
221 <tr><td style="text-align:right;"><img src="images/logo_example.png" border="0" height="41" width="41" align="bottom" /></td></tr>
222 </table>';
223
224 // output the HTML content
225 $pdf->writeHTML($html, true, false, true, false, '');
226
227 // reset pointer to the last page
228 $pdf->lastPage();
229
230 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
231 // Print all HTML colors
232
233 // add a page
234 $pdf->AddPage();
235
236 $textcolors = '<h1>HTML Text Colors</h1>';
237 $bgcolors = '<hr /><h1>HTML Background Colors</h1>';
238
239 foreach(TCPDF_COLORS::$webcolor as $k => $v) {
240 $textcolors .= '<span color="#'.$v.'">'.$v.'</span> ';
241 $bgcolors .= '<span bgcolor="#'.$v.'" color="#333333">'.$v.'</span> ';
242 }
243
244 // output the HTML content
245 $pdf->writeHTML($textcolors, true, false, true, false, '');
246 $pdf->writeHTML($bgcolors, true, false, true, false, '');
247
248 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
249
250 // Test word-wrap
251
252 // create some HTML content
253 $html = '<hr />
254 <h1>Various tests</h1>
255 <a href="#2">link to page 2</a><br />
256 <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font> <font face="courier"><b>thisisaverylongword</b></font> <font face="helvetica"><i>thisisanotherverylongword</i></font> <font face="times"><b>thisisaverylongword</b></font> thisisanotherverylongword <font face="times">thisisaverylongword</font>';
257
258 // output the HTML content
259 $pdf->writeHTML($html, true, false, true, false, '');
260
261 // Test fonts nesting
262 $html1 = 'Default <font face="courier">Courier <font face="helvetica">Helvetica <font face="times">Times <font face="dejavusans">dejavusans </font>Times </font>Helvetica </font>Courier </font>Default';
263 $html2 = '<small>small text</small> normal <small>small text</small> normal <sub>subscript</sub> normal <sup>superscript</sup> normal';
264 $html3 = '<font size="10" color="#ff7f50">The</font> <font size="10" color="#6495ed">quick</font> <font size="14" color="#dc143c">brown</font> <font size="18" color="#008000">fox</font> <font size="22"><a href="http://www.tcpdf.org">jumps</a></font> <font size="22" color="#a0522d">over</font> <font size="18" color="#da70d6">the</font> <font size="14" color="#9400d3">lazy</font> <font size="10" color="#4169el">dog</font>.';
265
266 $html = $html1.'<br />'.$html2.'<br />'.$html3.'<br />'.$html3.'<br />'.$html2;
267
268 // output the HTML content
269 $pdf->writeHTML($html, true, false, true, false, '');
270
271 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
272 // test pre tag
273
274 // add a page
275 $pdf->AddPage();
276
277 $html = <<<EOF
278 <div style="background-color:#880000;color:white;">
279 Hello World!<br />
280 Hello
281 </div>
282 <pre style="background-color:#336699;color:white;">
283 int main() {
284 printf("HelloWorld");
285 return 0;
286 }
287 </pre>
288 <tt>Monospace font</tt>, normal font, <tt>monospace font</tt>, normal font.
289 <br />
290 <div style="background-color:#880000;color:white;">DIV LEVEL 1<div style="background-color:#008800;color:white;">DIV LEVEL 2</div>DIV LEVEL 1</div>
291 <br />
292 <span style="background-color:#880000;color:white;">SPAN LEVEL 1 <span style="background-color:#008800;color:white;">SPAN LEVEL 2</span> SPAN LEVEL 1</span>
293 EOF;
294
295 // output the HTML content
296 $pdf->writeHTML($html, true, false, true, false, '');
297
298 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
299
300 // test custom bullet points for list
301
302 // add a page
303 $pdf->AddPage();
304
305 $html = <<<EOF
306 <h1>Test custom bullet image for list items</h1>
307 <ul style="font-size:14pt;list-style-type:img|png|4|4|images/logo_example.png">
308 <li>test custom bullet image</li>
309 <li>test custom bullet image</li>
310 <li>test custom bullet image</li>
311 <li>test custom bullet image</li>
312 <ul>
313 EOF;
314
315 // output the HTML content
316 $pdf->writeHTML($html, true, false, true, false, '');
317
318 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
319
320 // reset pointer to the last page
321 $pdf->lastPage();
322
323 // ---------------------------------------------------------
324
325 //Close and output PDF document
326 $pdf->Output('example_006.pdf', 'I');
327
328 //============================================================+
329 // END OF FILE
330 //============================================================+
331