Commit 4dcc093768d17622e169071c234571fb28d24604
1 parent
f9af74f481
Exists in
master
tcpdf_demo: added demo of PDF bookmarks
Showing 1 changed file with 14 additions and 2 deletions Side-by-side Diff
tcpdf_demo
View file @
4dcc093
... | ... | @@ -51,11 +51,18 @@ |
51 | 51 | |
52 | 52 | // write out the contents of the first page |
53 | 53 | $pdf->AddPage(); |
54 | + | |
55 | +// add a target to the top of the first page | |
54 | 56 | $topLink = $pdf->AddLink(); |
55 | 57 | $pdf->SetLink($topLink); |
56 | -//$pdf->AddFont('DejaVu','','DejaVuSansCondensed.ttf',true); | |
58 | + | |
59 | +// add a bookmark too | |
60 | +// - text, indent level, Y position, target page number, style, color, | |
61 | +// X position, link ID | |
62 | +$pdf->Bookmark("Page 1", 0, 0, '', 'B'); | |
63 | + | |
64 | +// set the font and size | |
57 | 65 | $pdf->AddFont('dejavusanscondensed','','dejavusanscondensed.php',true); |
58 | -//$pdf->SetFont('DejaVu', '', 20); | |
59 | 66 | $pdf->SetFont('dejavusanscondensed', '', 20); |
60 | 67 | $pdf->SetFont('', 'U'); |
61 | 68 | $ssfLink = $pdf->AddLink(); |
... | ... | @@ -78,6 +85,11 @@ |
78 | 85 | |
79 | 86 | // add the SSF file to the 2nd page |
80 | 87 | $pdf->AddPage(); |
88 | +// add a bookmark | |
89 | +// - text, indent level, Y position, target page number, style, color, | |
90 | +// X position, link ID | |
91 | +$pdf->Bookmark("Page 2", 0, 0, '', 'B'); | |
92 | + | |
81 | 93 | $pdf->SetLink($ssfLink); |
82 | 94 | $pdf->useTemplate($ssfTemplate); |
83 | 95 | $pdf->SetFont('Helvetica'); |