296 |
aurelien |
1 |
<?php
|
|
|
2 |
//============================================================+
|
|
|
3 |
// File name : example_028.php
|
|
|
4 |
// Begin : 2008-03-04
|
|
|
5 |
// Last Update : 2010-08-08
|
|
|
6 |
//
|
|
|
7 |
// Description : Example 028 for TCPDF class
|
|
|
8 |
// Changing page formats
|
|
|
9 |
//
|
|
|
10 |
// Author: Nicola Asuni
|
|
|
11 |
//
|
|
|
12 |
// (c) Copyright:
|
|
|
13 |
// Nicola Asuni
|
|
|
14 |
// Tecnick.com s.r.l.
|
|
|
15 |
// Via Della Pace, 11
|
|
|
16 |
// 09044 Quartucciu (CA)
|
|
|
17 |
// ITALY
|
|
|
18 |
// www.tecnick.com
|
|
|
19 |
// info@tecnick.com
|
|
|
20 |
//============================================================+
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
* Creates an example PDF TEST document using TCPDF
|
|
|
24 |
* @package com.tecnick.tcpdf
|
|
|
25 |
* @abstract TCPDF - Example: changing page formats
|
|
|
26 |
* @author Nicola Asuni
|
|
|
27 |
* @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
|
|
|
28 |
* @link http://tcpdf.org
|
|
|
29 |
* @license http://www.gnu.org/copyleft/lesser.html LGPL
|
|
|
30 |
* @since 2008-03-04
|
|
|
31 |
*/
|
|
|
32 |
|
|
|
33 |
require_once('../config/lang/eng.php');
|
|
|
34 |
require_once('../tcpdf.php');
|
|
|
35 |
|
|
|
36 |
// create new PDF document
|
|
|
37 |
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
38 |
|
|
|
39 |
// set document information
|
|
|
40 |
$pdf->SetCreator(PDF_CREATOR);
|
|
|
41 |
$pdf->SetAuthor('Nicola Asuni');
|
|
|
42 |
$pdf->SetTitle('TCPDF Example 028');
|
|
|
43 |
$pdf->SetSubject('TCPDF Tutorial');
|
|
|
44 |
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
|
|
45 |
|
|
|
46 |
// remove default header/footer
|
|
|
47 |
$pdf->setPrintHeader(false);
|
|
|
48 |
$pdf->setPrintFooter(false);
|
|
|
49 |
|
|
|
50 |
// set default monospaced font
|
|
|
51 |
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
|
|
|
52 |
|
|
|
53 |
//set margins
|
|
|
54 |
$pdf->SetMargins(10, PDF_MARGIN_TOP, 10);
|
|
|
55 |
|
|
|
56 |
//set auto page breaks
|
|
|
57 |
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
|
|
58 |
|
|
|
59 |
//set image scale factor
|
|
|
60 |
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
|
|
61 |
|
|
|
62 |
//set some language-dependent strings
|
|
|
63 |
$pdf->setLanguageArray($l);
|
|
|
64 |
|
|
|
65 |
// ---------------------------------------------------------
|
|
|
66 |
|
|
|
67 |
$pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
|
|
|
68 |
|
|
|
69 |
// set font
|
|
|
70 |
$pdf->SetFont('times', 'B', 20);
|
|
|
71 |
|
|
|
72 |
$pdf->AddPage('P', 'A4');
|
|
|
73 |
$pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C');
|
|
|
74 |
|
|
|
75 |
$pdf->AddPage('L', 'A4');
|
|
|
76 |
$pdf->Cell(0, 0, 'A4 LANDSCAPE', 1, 1, 'C');
|
|
|
77 |
|
|
|
78 |
$pdf->AddPage('P', 'A5');
|
|
|
79 |
$pdf->Cell(0, 0, 'A5 PORTRAIT', 1, 1, 'C');
|
|
|
80 |
|
|
|
81 |
$pdf->AddPage('L', 'A5');
|
|
|
82 |
$pdf->Cell(0, 0, 'A5 LANDSCAPE', 1, 1, 'C');
|
|
|
83 |
|
|
|
84 |
$pdf->AddPage('P', 'A6');
|
|
|
85 |
$pdf->Cell(0, 0, 'A6 PORTRAIT', 1, 1, 'C');
|
|
|
86 |
|
|
|
87 |
$pdf->AddPage('L', 'A6');
|
|
|
88 |
$pdf->Cell(0, 0, 'A6 LANDSCAPE', 1, 1, 'C');
|
|
|
89 |
|
|
|
90 |
$pdf->AddPage('P', 'A7');
|
|
|
91 |
$pdf->Cell(0, 0, 'A7 PORTRAIT', 1, 1, 'C');
|
|
|
92 |
|
|
|
93 |
$pdf->AddPage('L', 'A7');
|
|
|
94 |
$pdf->Cell(0, 0, 'A7 LANDSCAPE', 1, 1, 'C');
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
// --- test backward editing ---
|
|
|
98 |
|
|
|
99 |
|
|
|
100 |
$pdf->setPage(1, true);
|
|
|
101 |
$pdf->SetY(50);
|
|
|
102 |
$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C');
|
|
|
103 |
|
|
|
104 |
$pdf->setPage(2, true);
|
|
|
105 |
$pdf->SetY(50);
|
|
|
106 |
$pdf->Cell(0, 0, 'A4 test', 1, 1, 'C');
|
|
|
107 |
|
|
|
108 |
$pdf->setPage(3, true);
|
|
|
109 |
$pdf->SetY(50);
|
|
|
110 |
$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C');
|
|
|
111 |
|
|
|
112 |
$pdf->setPage(4, true);
|
|
|
113 |
$pdf->SetY(50);
|
|
|
114 |
$pdf->Cell(0, 0, 'A5 test', 1, 1, 'C');
|
|
|
115 |
|
|
|
116 |
$pdf->setPage(5, true);
|
|
|
117 |
$pdf->SetY(50);
|
|
|
118 |
$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C');
|
|
|
119 |
|
|
|
120 |
$pdf->setPage(6, true);
|
|
|
121 |
$pdf->SetY(50);
|
|
|
122 |
$pdf->Cell(0, 0, 'A6 test', 1, 1, 'C');
|
|
|
123 |
|
|
|
124 |
$pdf->setPage(7, true);
|
|
|
125 |
$pdf->SetY(40);
|
|
|
126 |
$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C');
|
|
|
127 |
|
|
|
128 |
$pdf->setPage(8, true);
|
|
|
129 |
$pdf->SetY(40);
|
|
|
130 |
$pdf->Cell(0, 0, 'A7 test', 1, 1, 'C');
|
|
|
131 |
|
|
|
132 |
$pdf->lastPage();
|
|
|
133 |
|
|
|
134 |
// ---------------------------------------------------------
|
|
|
135 |
|
|
|
136 |
//Close and output PDF document
|
|
|
137 |
$pdf->Output('example_028.pdf', 'I');
|
|
|
138 |
|
|
|
139 |
//============================================================+
|
|
|
140 |
// END OF FILE
|
|
|
141 |
//============================================================+
|