28 require_once(
'tcpdf_include.php');
35 $pdf->SetAuthor(
'Nicola Asuni');
36 $pdf->SetTitle(
'TCPDF Example 048');
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 HTML tables',
'', 0,
'L',
true, 0,
false,
false, 0);
77 $pdf->SetFont(
'helvetica',
'', 8);
82 <table cellspacing=
"0" cellpadding=
"1" border=
"1">
84 <td rowspan=
"3">COL 1 - ROW 1<br />COLSPAN 3</td>
85 <td>COL 2 - ROW 1</td>
86 <td>COL 3 - ROW 1</td>
89 <td rowspan=
"2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
90 <td>COL 3 - ROW 2</td>
93 <td>COL 3 - ROW 3</td>
99 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
104 <table cellspacing=
"0" cellpadding=
"1" border=
"1">
106 <td rowspan=
"3">COL 1 - ROW 1<br />COLSPAN 3<br />text line<br />text line<br />text line<br />text line<br />text line<br />text line</td>
107 <td>COL 2 - ROW 1</td>
108 <td>COL 3 - ROW 1</td>
111 <td rowspan=
"2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
112 <td>COL 3 - ROW 2</td>
115 <td>COL 3 - ROW 3</td>
121 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
126 <table cellspacing=
"0" cellpadding=
"1" border=
"1">
128 <td rowspan=
"3">COL 1 - ROW 1<br />COLSPAN 3<br />text line<br />text line<br />text line<br />text line<br />text line<br />text line</td>
129 <td>COL 2 - ROW 1</td>
130 <td>COL 3 - ROW 1</td>
133 <td rowspan=
"2">COL 2 - ROW 2 - COLSPAN 2<br />text line<br />text line<br />text line<br />text line</td>
134 <td>COL 3 - ROW 2<br />text line<br />text line</td>
137 <td>COL 3 - ROW 3</td>
143 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
150 <th rowspan=
"3">Left column</th>
151 <th colspan=
"5">Heading Column Span 5</th>
152 <th colspan=
"9">Heading Column Span 9</th>
155 <th rowspan=
"2">Rowspan 2<br />This
is some text
that fills
the table cell.</th>
156 <th colspan=
"2">span 2</th>
157 <th colspan=
"2">span 2</th>
158 <th rowspan=
"2">2 rows</th>
159 <th colspan=
"8">Colspan 8</th>
178 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
184 <table border=
"1" cellpadding=
"2" cellspacing=
"2">
186 <tr
style=
"background-color:#FFFF00;color:#0000FF;">
187 <td width=
"30" align=
"center"><b>A</b></td>
188 <td width=
"140" align=
"center"><b>XXXX</b></td>
189 <td width=
"140" align=
"center"><b>XXXX</b></td>
190 <td width=
"80" align=
"center"> <b>XXXX</b></td>
191 <td width=
"80" align=
"center"><b>XXXX</b></td>
192 <td width=
"45" align=
"center"><b>XXXX</b></td>
194 <tr style=
"background-color:#FF0000;color:#FFFF00;">
195 <td width=
"30" align=
"center"><b>
B</b></td>
196 <td width=
"140" align=
"center"><b>XXXX</b></td>
197 <td width=
"140" align=
"center"><b>XXXX</b></td>
198 <td width=
"80" align=
"center"> <b>XXXX</b></td>
199 <td width=
"80" align=
"center"><b>XXXX</b></td>
200 <td width=
"45" align=
"center"><b>XXXX</b></td>
204 <td width=
"30" align=
"center">1.</td>
205 <td width=
"140" rowspan=
"6">XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX</td>
206 <td width=
"140">XXXX<br />XXXX</td>
207 <td width=
"80">XXXX<br />XXXX</td>
208 <td width=
"80">XXXX</td>
209 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
212 <td width=
"30" align=
"center" rowspan=
"3">2.</td>
213 <td width=
"140" rowspan=
"3">XXXX<br />XXXX</td>
214 <td width=
"80">XXXX<br />XXXX</td>
215 <td width=
"80">XXXX<br />XXXX</td>
216 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
219 <td width=
"80">XXXX<br />XXXX<br />XXXX<br />XXXX</td>
220 <td width=
"80">XXXX<br />XXXX</td>
221 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
224 <td width=
"80" rowspan=
"2" >RRRRRR<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX<br />XXXX</td>
225 <td width=
"80">XXXX<br />XXXX</td>
226 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
229 <td width=
"30" align=
"center">3.</td>
230 <td width=
"140">XXXX1<br />XXXX</td>
231 <td width=
"80">XXXX<br />XXXX</td>
232 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
235 <td width=
"30" align=
"center">4.</td>
236 <td width=
"140">XXXX<br />XXXX</td>
237 <td width=
"80">XXXX<br />XXXX</td>
238 <td width=
"80">XXXX<br />XXXX</td>
239 <td align=
"center" width=
"45">XXXX<br />XXXX</td>
244 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
246 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
253 <table border=
"1" cellpadding=
"2" cellspacing=
"2" nobr=
"true">
255 <th colspan=
"3" align=
"center">NON-BREAKING TABLE</th>
275 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
282 <table border=
"1" cellpadding=
"2" cellspacing=
"2" align=
"center">
284 <th colspan=
"3">NON-BREAKING ROWS</th>
287 <td>ROW 1<br />COLUMN 1</td>
288 <td>ROW 1<br />COLUMN 2</td>
289 <td>ROW 1<br />COLUMN 3</td>
292 <td>ROW 2<br />COLUMN 1</td>
293 <td>ROW 2<br />COLUMN 2</td>
294 <td>ROW 2<br />COLUMN 3</td>
297 <td>ROW 3<br />COLUMN 1</td>
298 <td>ROW 3<br />COLUMN 2</td>
299 <td>ROW 3<br />COLUMN 3</td>
304 $pdf->writeHTML(
$tbl,
true,
false,
false,
false,
'');
309 $pdf->Output(
'example_048.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).
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.