PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.4.0
GiveWP – Donation Plugin and Fundraising Platform v4.4.0
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_001.php
example_001.php
111 lines 3.9 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_001.php
4 // Begin : 2008-03-04
5 // Last Update : 2013-05-14
6 //
7 // Description : Example 001 for TCPDF class
8 // Default Header and Footer
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: Default Header and Footer
23 * @author Nicola Asuni
24 * @since 2008-03-04
25 * @group header
26 * @group footer
27 * @group page
28 * @group pdf
29 */
30
31 // Include the main TCPDF library (search for installation path).
32 require_once('tcpdf_include.php');
33
34 // create new PDF document
35 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
36
37 // set document information
38 $pdf->setCreator(PDF_CREATOR);
39 $pdf->setAuthor('Nicola Asuni');
40 $pdf->setTitle('TCPDF Example 001');
41 $pdf->setSubject('TCPDF Tutorial');
42 $pdf->setKeywords('TCPDF, PDF, example, test, guide');
43
44 // set default header data
45 $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
46 $pdf->setFooterData(array(0,64,0), array(0,64,128));
47
48 // set header and footer fonts
49 $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
50 $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
51
52 // set default monospaced font
53 $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
54
55 // set margins
56 $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
57 $pdf->setHeaderMargin(PDF_MARGIN_HEADER);
58 $pdf->setFooterMargin(PDF_MARGIN_FOOTER);
59
60 // set auto page breaks
61 $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
62
63 // set image scale factor
64 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
65
66 // set some language-dependent strings (optional)
67 if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
68 require_once(dirname(__FILE__).'/lang/eng.php');
69 $pdf->setLanguageArray($l);
70 }
71
72 // ---------------------------------------------------------
73
74 // set default font subsetting mode
75 $pdf->setFontSubsetting(true);
76
77 // Set font
78 // dejavusans is a UTF-8 Unicode font, if you only need to
79 // print standard ASCII chars, you can use core fonts like
80 // helvetica or times to reduce file size.
81 $pdf->setFont('dejavusans', '', 14, '', true);
82
83 // Add a page
84 // This method has several options, check the source code documentation for more information.
85 $pdf->AddPage();
86
87 // set text shadow effect
88 $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
89
90 // Set some content to print
91 $html = <<<EOD
92 <h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a>!</h1>
93 <i>This is the first example of TCPDF library.</i>
94 <p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
95 <p>Please check the source code documentation and other examples for further information.</p>
96 <p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>
97 EOD;
98
99 // Print text using writeHTMLCell()
100 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
101
102 // ---------------------------------------------------------
103
104 // Close and output PDF document
105 // This method has several options, check the source code documentation for more information.
106 $pdf->Output('example_001.pdf', 'I');
107
108 //============================================================+
109 // END OF FILE
110 //============================================================+
111