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()
_getSplitDictionary()
Get and/or creates the split dictionary.
Parameters
- $create : bool
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.
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.
deleteFile()
Removes a file from the collection.
If the file doesn't exists false will be returned.
Parameters
- $name : string
The name with which the file is registered in the documents embedded files name tree.
getDictionary()
Get the collection dictionary.
Parameters
- $create : bool
getInitialDocument()
Get the name of the document, that should be initially presented.
Return Values
Null if it is not defined.
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.
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.
See
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
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.