Outlines Define How Bookmark Outlines Should Be Handled
Table of Contents
Introduction
The Core component already offers a great feature to access bookmark outlines. The Merger component allows you to automatically create a document outline by the $outlinesConfig
parameter in the addFile()
and addDocument()
methods.
It allows you to create a flat oulines tree but also allows you to create parent/child structures and will allow you to import existing bookmark outlines.
Create an Outline Item Per File/Document
The easiest way to define an outline item for an added file/document is to simply pass the name you want to see in the outline:
By default the destination that is created will use the fit to page zoom. This can be adjusted since revision 1330 by a fitMode key in the $outlinesConfig
array. You can pass an additional array structure which will be forwarded to the SetaPDF_Core_Document_Destination::createDestinationArray()
method internally:
$merger->addFile([ 'filename' => 'files/pdfs/tektown/products/Fantastic-Speaker.pdf', 'outlinesConfig' => [ \SetaPDF_Merger::OUTLINES_TITLE => 'Link to Fantastic-Speaker.pdf', \SetaPDF_Merger::OUTLINES_FIT_MODE => [\SetaPDF_Core_Document_Destination::FIT_MODE_XYZ, 100, 841.890, 4] ] ]);
Structure Outline Items
It is also possible to append the outline items as childs of an existing outline item:
Import an Existing Outline
The SetaPDF-Merger component allows you to import an existing bookmark outline from a document/file that was added to the instance. The bookmark outline can be appended to the root of the outline or below an individual outline item: