123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <?php
- require_once('tcpdf_include.php');
- $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- $pdf->setCreator(PDF_CREATOR);
- $pdf->setAuthor('Nicola Asuni');
- $pdf->setTitle('TCPDF Example 045');
- $pdf->setSubject('TCPDF Tutorial');
- $pdf->setKeywords('TCPDF, PDF, example, test, guide');
- $pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 045', PDF_HEADER_STRING);
- $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
- $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
- $pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- $pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
- $pdf->setHeaderMargin(PDF_MARGIN_HEADER);
- $pdf->setFooterMargin(PDF_MARGIN_FOOTER);
- $pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
- $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
- if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
- require_once(dirname(__FILE__).'/lang/eng.php');
- $pdf->setLanguageArray($l);
- }
- $pdf->setFont('times', 'B', 20);
- $pdf->AddPage();
- $pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128));
- $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L');
- $index_link = $pdf->AddLink();
- $pdf->setLink($index_link, 0, '*1');
- $pdf->Cell(0, 10, 'Link to INDEX', 0, 1, 'R', false, $index_link);
- $pdf->AddPage();
- $pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0));
- $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L');
- $pdf->AddPage();
- $pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0));
- $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L');
- $pdf->AddPage();
- $pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0));
- $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L');
- $pdf->AddPage();
- $pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0));
- $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L');
- $html = '<a href="#*1" style="color:blue;">link to INDEX (page 1)</a>';
- $pdf->writeHTML($html, true, false, true, false, '');
- for ($i = 2; $i < 12; $i++) {
- $pdf->AddPage();
- $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128));
- $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L');
- }
- $pdf->addTOCPage();
- $pdf->setFont('times', 'B', 16);
- $pdf->MultiCell(0, 0, 'Table Of Content', 0, 'C', 0, 1, '', '', true, 0);
- $pdf->Ln();
- $pdf->setFont('dejavusans', '', 12);
- $pdf->addTOC(1, 'courier', '.', 'INDEX', 'B', array(128,0,0));
- $pdf->endTOCPage();
- $pdf->Output('example_045.pdf', 'I');
|