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_029.php
example_029.php
127 lines 3.7 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_029.php
4 // Begin : 2008-06-09
5 // Last Update : 2013-05-14
6 //
7 // Description : Example 029 for TCPDF class
8 // Set PDF viewer display preferences.
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: Set PDF viewer display preferences.
23 * @author Nicola Asuni
24 * @since 2008-06-09
25 * @group viewer
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 029');
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.' 029', 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 strings (optional)
64 if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
65 require_once(dirname(__FILE__).'/lang/eng.php');
66 $pdf->setLanguageArray($l);
67 }
68
69 // ---------------------------------------------------------
70
71 // set array for viewer preferences
72 $preferences = array(
73 'HideToolbar' => true,
74 'HideMenubar' => true,
75 'HideWindowUI' => true,
76 'FitWindow' => true,
77 'CenterWindow' => true,
78 'DisplayDocTitle' => true,
79 'NonFullScreenPageMode' => 'UseNone', // UseNone, UseOutlines, UseThumbs, UseOC
80 'ViewArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox
81 'ViewClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox
82 'PrintArea' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox
83 'PrintClip' => 'CropBox', // CropBox, BleedBox, TrimBox, ArtBox
84 'PrintScaling' => 'AppDefault', // None, AppDefault
85 'Duplex' => 'DuplexFlipLongEdge', // Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge
86 'PickTrayByPDFSize' => true,
87 'PrintPageRange' => array(1,1,2,3),
88 'NumCopies' => 2
89 );
90
91 // Check the example n. 60 for advanced page settings
92
93 // set pdf viewer preferences
94 $pdf->setViewerPreferences($preferences);
95
96 // set font
97 $pdf->setFont('times', '', 14);
98
99 // add a page
100 $pdf->AddPage();
101
102 // print a line
103 $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 1', 1, 1, 'C');
104
105 $pdf->Ln(5);
106
107 $pdf->Write(0, 'You can use the setViewerPreferences() method to change viewer preferences.', '', 0, 'L', true, 0, false, false, 0);
108
109 // add a page
110 $pdf->AddPage();
111 // print a line
112 $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 2', 0, 0, 'C');
113
114 // add a page
115 $pdf->AddPage();
116 // print a line
117 $pdf->Cell(0, 12, 'DISPLAY PREFERENCES - PAGE 3', 0, 0, 'C');
118
119 // ---------------------------------------------------------
120
121 //Close and output PDF document
122 $pdf->Output('example_029.pdf', 'D');
123
124 //============================================================+
125 // END OF FILE
126 //============================================================+
127