SetaPDF_Merger_Collection Class for creating and managing PDF Collections (aka Portfolios, or Packages).

File: /SetaPDF v2/Merger/Collection.php

Class hierarchy

Summary

Constants

SORT_ASC

public const boolean SetaPDF_Merger_Collection::SORT_ASC = true

Sort in ascending order.

SORT_DESC

public const string SetaPDF_Merger_Collection::SORT_DESC = false

Sort in descending order.

SPLIT_HORIZONTALLY

Indicates that the window is split horizontally.

SPLIT_NO

public const string SetaPDF_Merger_Collection::SPLIT_NO = 'N'

Indicates that the window is not split. The entire window region shall be dedicated to the file navigation view.

SPLIT_VERTICALLY

public const string SetaPDF_Merger_Collection::SPLIT_VERTICALLY = 'V'

Indicates that the window is split vertically.

VIEW_DETAILS

public const string SetaPDF_Merger_Collection::VIEW_DETAILS = 'D'

The collection view shall be presented in details mode.

VIEW_HIDDEN

public const string SetaPDF_Merger_Collection::VIEW_HIDDEN = 'H'

The collection view shall be initially hidden.

VIEW_NAVIGATOR

public const string SetaPDF_Merger_Collection::VIEW_NAVIGATOR = 'C'

The collection view shall be presented by the navigator specified by the Navigator entry.

VIEW_TILE

public const string SetaPDF_Merger_Collection::VIEW_TILE = 'T'

The collection view shall be presented in tile mode.


Properties

$_document

The document instance of the cover sheet.

$_schema


Methods

__construct()

_getSplitDictionary()

Get and/or creates the split dictionary.

Parameters
$create : bool
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

addFile()

public SetaPDF_Merger_Collection::addFile (
SetaPDF_Core_Reader_ReaderInterface|string $pathOrReader, string $filename [, null|string $description = null [, array $fileStreamParams = array ( ) [, null|string $mimeType = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]]
): string

Add a file to the collection.

Parameters
$pathOrReader : SetaPDF_Core_Reader_ReaderInterface|string

A reader instance or a path to a file.

$filename : string

The filename in UTF-8 encoding.

$description : null|string

The description of the file in UTF-8 encoding.

$fileStreamParams : array

See SetaPDF_Core_EmbeddedFileStream::setParams() method.

$mimeType : null|string

The subtype of the embedded file. Shall conform to the MIME media type names defined in Internet RFC 2046

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

Return Values

The name that was used to register the file specification in the embedded files name tree.

Exceptions

Throws SetaPDF_Core_DataStructure_Tree_KeyAlreadyExistsException

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

addFolder()

public SetaPDF_Merger_Collection::addFolder (
string $name [, null|string $description = null [, DateTime|null $creationDate = null [, DateTime|null $modificationDate = null [, null|array|SetaPDF_Merger_Collection_Item $collectionItem = null ]]]]
): SetaPDF_Merger_Collection_Folder

Add a folder to the collection.

Parameters
$name : string

The folder name.

$description : null|string

The description of the folder.

$creationDate : DateTime|null

If null "now" will be used.

$modificationDate : DateTime|null

If null "now" will be used.

$collectionItem : null|array|SetaPDF_Merger_Collection_Item

The data described by the collection schema.

Exceptions

Throws SetaPDF_Core_Document_ObjectNotFoundException

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Parser_Pdf_InvalidTokenException

Throws SetaPDF_Core_Reader_Exception

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

Throws SetaPDF_Merger_Exception

cleanUp()

public SetaPDF_Merger_Collection::cleanUp (
void
): void

Release cylced referenced.

deleteFile()

public SetaPDF_Merger_Collection::deleteFile (
string $name
): bool

Removes a file from the collection.

If the file doesn't exist false will be returned.

Parameters
$name : string

The name with which the file is registered in the documents embedded files name tree.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getDictionary()

public SetaPDF_Merger_Collection::getDictionary (
[ bool $create = false ]
): null|SetaPDF_Core_Type_Dictionary

Get the collection dictionary.

Parameters
$create : bool
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getDocument()

Get the document instance.

getFile()

Get a file by its name in the embedded files name tree.

Parameters
$name : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getFiles()

Get all embedded files from this collection/document.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getInitialDocument()

public SetaPDF_Merger_Collection::getInitialDocument (
void
): string|null

Get the name of the document, that should be initially presented.

Return Values

Null if it is not defined.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getRootFolder()

public SetaPDF_Merger_Collection::getRootFolder (
[ boolean $create = false ]
): SetaPDF_Merger_Collection_Folder|null

Get and/or created the root folder instance.

To ensure that a root folder is created pass true as the $create parameter.

Parameters
$create : boolean

Defines whether to create the folder if it does not exists or not.

Exceptions

Throws SetaPDF_Core_Document_ObjectNotFoundException

Throws SetaPDF_Core_Exception

Throws SetaPDF_Core_Parser_Pdf_InvalidTokenException

Throws SetaPDF_Core_Reader_Exception

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_Type_IndirectReference_Exception

Throws SetaPDF_Exception

Throws SetaPDF_Exception_NotImplemented

getSchema()

Get the schema instance.

getSort()

public SetaPDF_Merger_Collection::getSort (
void
): array

Get the data which specifies the order in which in the collection shall be sorted in the user interface.

Return Values

The key is the field name, while the value describing the direction.

Exceptions

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Core_SecHandler_Exception

See

getSplitterDirection()

public SetaPDF_Merger_Collection::getSplitterDirection (
void
): string|null

Get the orientation of the splitter bar.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getSplitterPosition()

public SetaPDF_Merger_Collection::getSplitterPosition (
void
): number|null

Get the initial position of the splitter bar.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

getView()

public SetaPDF_Merger_Collection::getView (
void
): string

Get the initial view.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

isCollection()

public SetaPDF_Merger_Collection::isCollection (
void
): boolean

Checks whether the document instance has the Collection dictionary defined or not.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

setInitialDocument()

public SetaPDF_Merger_Collection::setInitialDocument (
string $name
): void

Set the name of the document, that should be initially presented.

If you want to open a document, that is located in a subfolder, you will need to pass the id of the subfolder as a prefix to the name:

$collection->setInitialDocument('<' . $folder->getId() . '>' . $name);
Parameters
$name : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

setSort()

public SetaPDF_Merger_Collection::setSort (
array $sort
): void

Set the data that specifies the order in which the collection shall be sorted in the user interface.

Parameters
$sort : array

The key is the field name, while the value defines the direction. Valid key names are field names defined in the schema or SetaPDF_Merger_Collection_Schema::DATA_* constants.

Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

See

setSplitterDirection()

public SetaPDF_Merger_Collection::setSplitterDirection (
string $direction
): void

Set the orientation of the splitter bar.

Parameters
$direction : string
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception

setSplitterPosition()

public SetaPDF_Merger_Collection::setSplitterPosition (
number $position
): void

Set the initial position of the splitter bar.

Parameters
$position : number
 
Exceptions

Throws SetaPDF_Core_SecHandler_Exception

Throws SetaPDF_Core_Type_Exception