Manuals

 

SetaPDF_Merger::addFile()

Description

class SetaPDF_Merger extends SetaPDF {
void addFile ( string $fileName[, mixed $pages=false[, array $bookmark=null]] ) }

Add a given file and the desired pages to the resulting pdf document.

Parameters

$fileName

A string that defines the path (relative or absolute) to the document. Only local paths are allowed.

$pages

In this parameter you can define the page(s) which should be read from the given document.

A single page can be defined as an integer value. A range can be defined as an array with 2 values:

array($startPage, $endPage)

$bookmark

This parameter defines the handling of a bookmark entry for this page range/document. There are a few possibilities for this parameter:

1. Pass null or omit the parameter will tell the API to resolve the title text for the bookmark entry from the meta data of the merged document.

2. Pass a simple string to this parameter, which will become the title text in the bookmark entry.

3. Pass false to prevent a bookmark creation for this page range/document.

4. Pass an array with the following structure:

array(
  'title' => (string) "The bookmark title"
  'color' => array(red, green, blue) // Text color
  'format' => SETAPDF_M_BOOKMARK_FORMAT_ITALIC | SETAPDF_M_BOOKMARK_FORMAT_BOLD,
  'parent' => an Id of a parent node returned by addFile,
  'copyBookmarks' => SETAPDF_M_COPY_BOOKMARKS_AS_CHILD || SETAPDF_M_COPY_BOOKMARKS_TO_SAME_LEVEL
)

All keys are optional and are described here with examples and detailed description.

Return Value

Will return an unique id, if the method call adds a new bookmark entry, which can be reused in the bookmark parameter to build a child/parent structure.

If the method call will not create a bookmark entry or will just import existing bookmark nodes into the same level, the method will return null.