Commit 9d13742da44d526a8c4345f94271120cbce777a2
1 parent
001b97d56e
pdflib_demo: added code that should produce links
- Switched back to the portrait SSF from P771 - Added a function `linkAttribs()` that would create the text for setting up attributes for links
Showing 1 changed file with 17 additions and 2 deletions Side-by-side Diff
pdflib_demo
View file @
9d13742
... | ... | @@ -29,6 +29,11 @@ |
29 | 29 | //require_once('tcpdf_include.php'); |
30 | 30 | $outfile = __DIR__ . '/output.pdf'; |
31 | 31 | |
32 | +// page placement defaults | |
33 | +$pageTopYPortrait = 750; | |
34 | +$pageTopYLandscape = 570; | |
35 | + | |
36 | + | |
32 | 37 | // wrap PDFlib usage in a try{} block |
33 | 38 | try { |
34 | 39 | $pdf = new PDFlib(); |
... | ... | @@ -79,8 +84,13 @@ |
79 | 84 | $pdf->close_pdi_document($ssfPDF); |
80 | 85 | |
81 | 86 | // write some text on to the page |
82 | - $pdf->fit_textline("Back to Top", 20, 570, | |
83 | - $textOpts . " underline=true"); | |
87 | + // for landscape mode... | |
88 | + //$pdf->fit_textline("Back to Top", 20, 570, | |
89 | + //$linkOpts = linkAttribs(1, 750); | |
90 | + $optList = "destination={page=1 type=fixed left=0 top=750}"; | |
91 | + $action = $p->create_action("GoTo", $optList); | |
92 | + print_r($linkOpts); | |
93 | + $pdf->fit_textline("Back to Top", 20, 750, $linkOpts); | |
84 | 94 | |
85 | 95 | // END PAGE 2 |
86 | 96 | $pdf->end_page_ext(''); |
... | ... | @@ -101,6 +111,11 @@ |
101 | 111 | } |
102 | 112 | |
103 | 113 | $p = 0; |
114 | + | |
115 | +function linkAttribs($pageNum = 1, $pageY = 750) { | |
116 | + return "destination={page={$pageNum} type=fixed left=0 top={$pageY}}" | |
117 | + . " underline=true"; | |
118 | +} | |
104 | 119 | |
105 | 120 | /* |
106 | 121 | // write out the contents of the first page |