Esempio n. 1
0
// Open the document that was saved in the previous code sample
$doc = new PDFDoc($output_path . "bookmark.pdf");
$doc->InitSecurityHandler();
$root = $doc->GetFirstBookmark();
PrintOutlineTree($root);
echo "Done.";
// The following example illustrates how to create a Bookmark to a page
// in a remote document. A remote go-to action is similar to an ordinary
// go-to action, but jumps to a destination in another PDF file instead
// of the current file. See Section 8.5.3 'Remote Go-To Actions' in PDF
// Reference Manual for details.
// Open the document that was saved in the previous code sample
$doc = new PDFDoc($output_path . "bookmark.pdf");
$doc->InitSecurityHandler();
// Create file specification (the file referred to by the remote bookmark)
$file_spec = $doc->CreateIndirectDict();
$file_spec->PutName("Type", "Filespec");
$file_spec->PutString("F", "bookmark.pdf");
$spec = new FileSpec($file_spec);
$goto_remote = Action::CreateGotoRemote($spec, 5, true);
$remoteBookmark1 = Bookmark::Create($doc, "REMOTE BOOKMARK 1");
$remoteBookmark1->SetAction($goto_remote);
$doc->AddRootBookmark($remoteBookmark1);
// Create another remote bookmark, but this time using the low-level SDF/Cos API.
// Create a remote action
$remoteBookmark2 = Bookmark::Create($doc, "REMOTE BOOKMARK 2");
$doc->AddRootBookmark($remoteBookmark2);
$gotoR = $remoteBookmark2->GetSDFObj()->PutDict("A");
$gotoR->PutName("S", "GoToR");
// Set action type
$gotoR->PutBool("NewWindow", true);