note 14515 added to function.pdf-add-bookmark.php
| From: | bob at nijman dot de | Date: | Thu, 02 Aug 2001 12:24:54 +0000 |
| Subject: | note 14515 added to function.pdf-add-bookmark.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16229@lists.php.net to get a copy of this message | ||
try this:
<?php
//Create & Open PDF-Object
$pdf = pdf_new();
pdf_open_file($pdf);
pdf_set_info($pdf, "Author","Bob Nijman");
pdf_begin_page($pdf, 300, 300);
$bookmark = pdf_add_bookmark($pdf, "People");
pdf_add_bookmark($pdf, "Rasmus", $bookmark);
pdf_set_font($pdf, "Helvetica", 20, "host");
$text = "This is R's page";
$width = pdf_stringwidth($pdf, $text);
pdf_set_text_pos($pdf, (300-$width)/2, 100);
pdf_show($pdf, $text);
pdf_end_page($pdf);
pdf_begin_page($pdf, 300, 300);
$text = "This is T's page";
pdf_add_bookmark($pdf, "Thomas", $bookmark);
$pdfimage = pdf_open_image_file($pdf, "jpeg", "test.jpg");
pdf_place_image($pdf, $pdfimage, 10, 100, 0.7);
//close it up
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header('Content-disposition: inline; filename=myTest.pdf');
header('Content-length: ' . strlen($data));
echo $data;
?>
http://www.php.net/manual/en/function.pdf-add-bookmark.php