29 require_once(
'tcpdf_include.php');
36 $pdf->SetAuthor(
'Nicola Asuni');
37 $pdf->SetTitle(
'TCPDF Example 015');
38 $pdf->SetSubject(
'TCPDF Tutorial');
39 $pdf->SetKeywords(
'TCPDF, PDF, example, test, guide');
63 if (@file_exists(dirname(__FILE__).
'/lang/eng.php')) {
64 require_once(dirname(__FILE__).
'/lang/eng.php');
65 $pdf->setLanguageArray(
$l);
73 $pdf->SetFont(
'times',
'B', 20);
79 $pdf->Bookmark(
'Chapter 1', 0, 0,
'',
'B',
array(0,64,128));
82 $pdf->Cell(0, 10,
'Chapter 1', 0, 1,
'L');
84 $pdf->SetFont(
'times',
'I', 14);
85 $pdf->Write(0,
'You can set PDF Bookmarks using the Bookmark() method. 86 You can set PDF Named Destinations using the setDestination() method.');
88 $pdf->SetFont(
'times',
'B', 20);
93 $pdf->Bookmark(
'Paragraph 1.1', 1, 0,
'',
'',
array(0,0,0));
94 $pdf->Cell(0, 10,
'Paragraph 1.1', 0, 1,
'L');
97 $pdf->Bookmark(
'Paragraph 1.2', 1, 0,
'',
'',
array(0,0,0));
98 $pdf->Cell(0, 10,
'Paragraph 1.2', 0, 1,
'L');
101 $pdf->Bookmark(
'Sub-Paragraph 1.2.1', 2, 0,
'',
'I',
array(0,0,0));
102 $pdf->Cell(0, 10,
'Sub-Paragraph 1.2.1', 0, 1,
'L');
105 $pdf->Bookmark(
'Paragraph 1.3', 1, 0,
'',
'',
array(0,0,0));
106 $pdf->Cell(0, 10,
'Paragraph 1.3', 0, 1,
'L');
110 $pdf->setDestination(
'chapter2', 0,
'');
112 $pdf->Bookmark(
'Chapter 2', 0, 0,
'',
'BI',
array(128,0,0), -1,
'#chapter2');
113 $pdf->Cell(0, 10,
'Chapter 2', 0, 1,
'L');
114 $pdf->SetFont(
'times',
'I', 14);
115 $pdf->Write(0,
'Once saved, you can open this document at this page using the link: "example_015.pdf#chapter2".');
118 $pdf->setDestination(
'chapter3', 0,
'');
119 $pdf->SetFont(
'times',
'B', 20);
120 $pdf->Bookmark(
'Chapter 3', 0, 0,
'',
'B',
array(0,64,128));
121 $pdf->Cell(0, 10,
'Chapter 3', 0, 1,
'L');
124 $pdf->setDestination(
'chapter4', 0,
'');
125 $pdf->SetFont(
'times',
'B', 20);
126 $pdf->Bookmark(
'Chapter 4', 0, 0,
'',
'B',
array(0,64,128));
127 $pdf->Cell(0, 10,
'Chapter 4', 0, 1,
'L');
130 $pdf->Bookmark(
'Chapter 5', 0, 0,
'',
'B',
array(0,128,0));
131 $pdf->Cell(0, 10,
'Chapter 5', 0, 1,
'L');
132 $txt =
'Example of File Attachment. 133 Double click on the icon to open the attached file.';
134 $pdf->SetFont(
'helvetica',
'', 10);
135 $pdf->Write(0,
$txt,
'', 0,
'L',
true, 0,
false,
false, 0);
138 $pdf->Annotation(20, 50, 5, 5,
'TXT file',
array(
'Subtype'=>
'FileAttachment',
'Name' =>
'PushPin',
'FS' =>
'data/utf8test.txt'));
141 $pdf->Annotation(50, 50, 5, 5,
'PDF file',
array(
'Subtype'=>
'FileAttachment',
'Name' =>
'PushPin',
'FS' =>
'example_012.pdf'));
145 $pdf->Bookmark(
'TXT file', 0, 0,
'',
'B',
array(128,0,255), -1,
'*utf8test.txt');
149 $pdf->Bookmark(
'PDF file', 0, 0,
'',
'B',
array(128,0,255), -1,
'%example_012.pdf');
152 $pdf->Bookmark(
'External URL', 0, 0,
'',
'B',
array(0,0,255), -1,
'http://www.tcpdf.org');
157 $pdf->Output(
'example_015.pdf',
'D');
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.