28 require_once(
'tcpdf_include.php');
35 $pdf->SetAuthor(
'Nicola Asuni');
36 $pdf->SetTitle(
'TCPDF Example 057');
37 $pdf->SetSubject(
'TCPDF Tutorial');
38 $pdf->SetKeywords(
'TCPDF, PDF, example, test, guide');
62 if (@file_exists(dirname(__FILE__).
'/lang/eng.php')) {
63 require_once(dirname(__FILE__).
'/lang/eng.php');
64 $pdf->setLanguageArray(
$l);
70 $pdf->SetFont(
'helvetica',
'B', 20);
75 $pdf->Write(0,
'Example of alignment options for Cell()',
'', 0,
'L',
true, 0,
false,
false, 0);
77 $pdf->SetFont(
'helvetica',
'', 11);
80 $pdf->SetLineWidth(0.7);
83 $pdf->SetDrawColor(0,128,255);
85 $pdf->setCellHeightRatio(3);
90 $pdf->Cell(30, 0,
'Top-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'T',
'C');
91 $pdf->Cell(30, 0,
'Center-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'C',
'C');
92 $pdf->Cell(30, 0,
'Bottom-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'B',
'C');
93 $pdf->Cell(30, 0,
'Ascent-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'A',
'C');
94 $pdf->Cell(30, 0,
'Baseline-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'L',
'C');
95 $pdf->Cell(30, 0,
'Descent-Center', 1, $ln=0,
'C', 0,
'', 0,
false,
'D',
'C');
101 $pdf->Cell(30, 0,
'Top-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'T',
'T');
102 $pdf->Cell(30, 0,
'Center-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'C',
'T');
103 $pdf->Cell(30, 0,
'Bottom-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'B',
'T');
104 $pdf->Cell(30, 0,
'Ascent-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'A',
'T');
105 $pdf->Cell(30, 0,
'Baseline-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'L',
'T');
106 $pdf->Cell(30, 0,
'Descent-Top', 1, $ln=0,
'C', 0,
'', 0,
false,
'D',
'T');
109 $pdf->SetXY(15, 120);
112 $pdf->Cell(30, 0,
'Top-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'T',
'B');
113 $pdf->Cell(30, 0,
'Center-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'C',
'B');
114 $pdf->Cell(30, 0,
'Bottom-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'B',
'B');
115 $pdf->Cell(30, 0,
'Ascent-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'A',
'B');
116 $pdf->Cell(30, 0,
'Baseline-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'L',
'B');
117 $pdf->Cell(30, 0,
'Descent-Bottom', 1, $ln=0,
'C', 0,
'', 0,
false,
'D',
'B');
121 $linestyle =
array(
'width' => 0.1,
'cap' =>
'butt',
'join' =>
'miter',
'dash' =>
'',
'phase' => 0,
'color' =>
array(255, 0, 0));
130 $pdf->Image(
'images/tcpdf_cell.png', 15, 160, 100, 100,
'PNG',
'',
'',
false, 300,
'',
false,
false, 0,
false,
false,
false);
133 X: cell x top-left origin (top-right for RTL) 134 Y: cell y top-left origin (top-right for RTL) 138 NRL: normal line position 139 EXT: external line position 140 INT: internal line position 153 $pdf->SetFont(
'helvetica',
'', 10);
154 $pdf->setCellHeightRatio(1.25);
155 $pdf->MultiCell(0, 0,
$legend, 0,
'L',
false, 1, 125, 160,
true, 0,
false,
true, 0,
'T',
false);
164 $pdf->SetFont(
'helvetica',
'B', 20);
166 $pdf->Write(0,
'Example of borders for Cell()',
'', 0,
'L',
true, 0,
false,
false, 0);
168 $pdf->SetFont(
'helvetica',
'', 11);
171 $pdf->SetLineWidth(0.508);
174 $pdf->SetDrawColor(0,128,255);
177 $pdf->SetFillColor(255,255,128);
180 $pdf->setCellHeightRatio(3);
182 $pdf->Cell(30, 0,
'1', 1, 1,
'C', 1,
'', 0,
false,
'T',
'C');
184 $pdf->Cell(30, 0,
'LTRB',
'LTRB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
186 $pdf->Cell(30, 0,
'LTR',
'LTR', 1,
'C', 1,
'', 0,
false,
'T',
'C');
188 $pdf->Cell(30, 0,
'TRB',
'TRB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
190 $pdf->Cell(30, 0,
'LRB',
'LRB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
192 $pdf->Cell(30, 0,
'LTB',
'LTB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
194 $pdf->Cell(30, 0,
'LT',
'LT', 1,
'C', 1,
'', 0,
false,
'T',
'C');
196 $pdf->Cell(30, 0,
'TR',
'TR', 1,
'C', 1,
'', 0,
false,
'T',
'C');
198 $pdf->Cell(30, 0,
'RB',
'RB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
200 $pdf->Cell(30, 0,
'LB',
'LB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
202 $pdf->Cell(30, 0,
'LR',
'LR', 1,
'C', 1,
'', 0,
false,
'T',
'C');
204 $pdf->Cell(30, 0,
'TB',
'TB', 1,
'C', 1,
'', 0,
false,
'T',
'C');
206 $pdf->Cell(30, 0,
'L',
'L', 1,
'C', 1,
'', 0,
false,
'T',
'C');
208 $pdf->Cell(30, 0,
'T',
'T', 1,
'C', 1,
'', 0,
false,
'T',
'C');
210 $pdf->Cell(30, 0,
'R',
'R', 1,
'C', 1,
'', 0,
false,
'T',
'C');
212 $pdf->Cell(30, 0,
'B',
'B', 1,
'C', 1,
'', 0,
false,
'T',
'C');
221 $pdf->SetFont(
'helvetica',
'B', 20);
223 $pdf->Write(0,
'Example of advanced border settings for Cell()',
'', 0,
'L',
true, 0,
false,
false, 0);
225 $pdf->SetFont(
'helvetica',
'', 11);
228 $pdf->SetLineWidth(1);
231 $pdf->SetDrawColor(0,128,255);
234 $pdf->SetFillColor(255,255,128);
236 $border =
array(
'LTRB' =>
array(
'width' => 2,
'cap' =>
'butt',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(255, 0, 0)));
237 $pdf->Cell(30, 0,
'LTRB',
$border, 1,
'C', 1,
'', 0,
false,
'T',
'C');
241 'L' =>
array(
'width' => 2,
'cap' =>
'square',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(255, 0, 0)),
242 'R' =>
array(
'width' => 2,
'cap' =>
'square',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(255, 0, 255)),
243 'T' =>
array(
'width' => 2,
'cap' =>
'square',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(0, 255, 0)),
244 'B' =>
array(
'width' => 2,
'cap' =>
'square',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(0, 0, 255)));
245 $pdf->Cell(30, 0,
'LTRB',
$border, 1,
'C', 1,
'', 0,
false,
'T',
'C');
248 $border =
array(
'mode' =>
'ext',
'LTRB' =>
array(
'width' => 2,
'cap' =>
'butt',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(255, 0, 0)));
249 $pdf->Cell(30, 0,
'LTRB EXT',
$border, 1,
'C', 1,
'', 0,
false,
'T',
'C');
252 $border =
array(
'mode' =>
'int',
'LTRB' =>
array(
'width' => 2,
'cap' =>
'butt',
'join' =>
'miter',
'dash' => 0,
'color' =>
array(255, 0, 0)));
253 $pdf->Cell(30, 0,
'LTRB INT',
$border, 1,
'C', 1,
'', 0,
false,
'T',
'C');
264 $pdf->Output(
'example_057.pdf',
'I');
const PDF_MARGIN_BOTTOM
Bottom margin.
const PDF_MARGIN_LEFT
Left margin.
const PDF_MARGIN_HEADER
Header margin.
const PDF_HEADER_STRING
Header description string.
const PDF_FONT_SIZE_MAIN
Default main font size.
const PDF_FONT_SIZE_DATA
Default data font size.
const PDF_FONT_NAME_MAIN
Default main font name.
PHP class for generating PDF documents without requiring external extensions.
const PDF_HEADER_LOGO_WIDTH
Header logo image width in user units.
const PDF_HEADER_LOGO
Deafult image logo used be the default Header() method.
const PDF_UNIT
Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
const PDF_IMAGE_SCALE_RATIO
Ratio used to adjust the conversion of pixels to user units.
const PDF_PAGE_ORIENTATION
Page orientation (P=portrait, L=landscape).
Create styles array
The data for the language used.
const PDF_MARGIN_RIGHT
Right margin.
const PDF_HEADER_TITLE
Header title.
const PDF_FONT_NAME_DATA
Default data font name.
const PDF_CREATOR
Document creator.
const PDF_PAGE_FORMAT
Page format.
const PDF_FONT_MONOSPACED
Default monospaced font name.
const PDF_MARGIN_TOP
Top margin.
const PDF_MARGIN_FOOTER
Footer margin.