SetaPDF Demos

Add Outline Item

This demo opens a document with a bookmark outline and adds an additional item to the end of the outline.


// load and register the autoload function
require_once '../../../../../bootstrap.php';

$writer = new SetaPDF_Core_Writer_Http('Brand-Guide.pdf', true);
// create a document instance
$document = SetaPDF_Core_Document::loadByFilename($assetsDirectory . '/pdfs/Brand-Guide.pdf', $writer);

// get the outlines helper
$outlines = $document->getCatalog()->getOutlines();

// create an item instance
$item = SetaPDF_Core_Document_OutlinesItem::create($document, '© Setasign');
// make it bold

// create an Uri action
$action = new SetaPDF_Core_Document_Action_Uri('');
// add the action to the item

// add it to the root outline

// show the outline panel

// save and finish the document instance