SetaPDF_Merger_Collection Class for creating and managing PDF Collections (aka Portfolios, or Packages).
File: /SetaPDF v2/Merger/Collection.php
Class hierarchy
Summary
Methods
- __construct()
- _getSplitDictionary()
- addFile()
- addFolder()
- cleanUp()
- deleteFile()
- getDictionary()
- getDocument()
- getFile()
- getFiles()
- getInitialDocument()
- getRootFolder()
- getSchema()
- getSort()
- getSplitterDirection()
- getSplitterPosition()
- getView()
- hasFolders()
- isCollection()
- setInitialDocument()
- setSort()
- setSplitterDirection()
- setSplitterPosition()
- setView()
Constants
SORT_ASC
Sort in ascending order.
SORT_DESC
Sort in descending order.
SPLIT_HORIZONTALLY
Indicates that the window is split horizontally.
SPLIT_NO
Indicates that the window is not split. The entire window region shall be dedicated to the file navigation view.
SPLIT_VERTICALLY
Indicates that the window is split vertically.
VIEW_DETAILS
The collection view shall be presented in details mode.
VIEW_HIDDEN
The collection view shall be initially hidden.
VIEW_NAVIGATOR
The collection view shall be presented by the navigator specified by the Navigator entry.
VIEW_TILE
The collection view shall be presented in tile mode.
Properties
Methods
__construct()
The constructor.
Parameters
- $document : SetaPDF_Core_Document
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_getSplitDictionary()
Get and/or creates the split dictionary.
Parameters
- $create : bool
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
addFile()
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()
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
deleteFile()
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()
Get the collection dictionary.
Parameters
- $create : bool
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
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()
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()
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
getSort()
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()
Get the orientation of the splitter bar.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
getSplitterPosition()
Get the initial position of the splitter bar.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
getView()
Get the initial view.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
hasFolders()
Checks whether this collection has folders 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
isCollection()
Checks whether the document instance has the Collection dictionary defined or not.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setInitialDocument()
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()
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()
Set the orientation of the splitter bar.
Parameters
- $direction : string
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setSplitterPosition()
Set the initial position of the splitter bar.
Parameters
- $position : number
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setView()
Set the initial view.
Parameters
- $view : string
A view constant.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception