diff --git a/pdflib_demo b/pdflib_demo index 64bcc08..ed478a5 100755 --- a/pdflib_demo +++ b/pdflib_demo @@ -29,6 +29,11 @@ date_default_timezone_set("America/Los_Angeles"); //require_once('tcpdf_include.php'); $outfile = __DIR__ . '/output.pdf'; +// page placement defaults +$pageTopYPortrait = 750; +$pageTopYLandscape = 570; + + // wrap PDFlib usage in a try{} block try { $pdf = new PDFlib(); @@ -79,8 +84,13 @@ try { $pdf->close_pdi_document($ssfPDF); // write some text on to the page - $pdf->fit_textline("Back to Top", 20, 570, - $textOpts . " underline=true"); + // for landscape mode... + //$pdf->fit_textline("Back to Top", 20, 570, + //$linkOpts = linkAttribs(1, 750); + $optList = "destination={page=1 type=fixed left=0 top=750}"; + $action = $p->create_action("GoTo", $optList); + print_r($linkOpts); + $pdf->fit_textline("Back to Top", 20, 750, $linkOpts); // END PAGE 2 $pdf->end_page_ext(''); @@ -102,6 +112,11 @@ catch (Exception $e) { $p = 0; +function linkAttribs($pageNum = 1, $pageY = 750) { + return "destination={page={$pageNum} type=fixed left=0 top={$pageY}}" + . " underline=true"; +} + /* // write out the contents of the first page $pdf->AddPage();