setasign\SetaPDF2\Merger\Collection
Folder Class representing a folder in a PDF Collection/Portfolio/Package.
File: /SetaPDF v2/Merger/Collection/Folder.php
Old class name (alias):
\SetaPDF_Merger_Collection_Folder
Class hierarchy
Summary
Methods
- __construct()
- _getFiles()
- addFile()
- addFolder()
- delete()
- deleteFile()
- getChilds()
- getCollection()
- getCollectionItem()
- getCreationDate()
- getDescription()
- getDictionary()
- getFile()
- getFiles()
- getId()
- getIndirectObject()
- getModificationDate()
- getName()
- getParent()
- getSubfolder()
- getSubfolders()
- hasSubfolders()
- setCollectionItem()
- setCreationDate()
- setDescription()
- setModificationDate()
- setName()
- setParent()
Properties
Methods
__construct()
string|\setasign\SetaPDF2\Core\Type\IndirectObjectInterface $indirectObjectOrName
The constructor.
Parameters
- $collection : \setasign\SetaPDF2\Merger\Collection
- $indirectObjectOrName : string|\setasign\SetaPDF2\Core\Type\IndirectObjectInterface
A folder name or an indirect object/reference to a dictionary representing a folder.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
_getFiles()
Get all file specifications defined for this folder.
Exceptions
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Merger\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
addFile()
string $filename,
?string $description = null,
array $fileStreamParams = array ( ),
?string $mimeType = null,
null|array|Item $collectionItem = null
Add a file to this folder.
Parameters
- $pathOrReader : \setasign\SetaPDF2\Core\Reader\ReaderInterface|string
A reader instance or a path to a file.
- $filename : string
The filename in UTF-8 encoding.
- $description : ?string
The description of the file.
- $fileStreamParams : array
See \setasign\SetaPDF2\Core\EmbeddedFileStream::setParams() method.
- $mimeType : ?string
The subtype of the embedded file. Shall conform to the MIME media type names defined in Internet RFC 2046
- $collectionItem : null|array|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 \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Merger\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\DataStructure\Tree\KeyAlreadyExistsException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
addFolder()
?string $description = null,
?\DateTime $creationDate = null,
?\DateTime $modificationDate = null,
null|array|Item $collectionItem = null
Add a subfolder to this folder.
Parameters
- $name : string
The folder name.
- $description : ?string
The description of the folder.
- $creationDate : ?\DateTime
If null "now" will be used.
- $modificationDate : ?\DateTime
If null "now" will be used.
- $collectionItem : null|array|Item
The data described by the collection schema.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \setasign\SetaPDF2\Merger\Exception
Throws \Exception
delete()
Delete this folder, subfolders and files.
Parameters
- $recursive : bool
Whether folders should be deleted recursively or not.
- $removeEmbeddedFiles : bool
Whether file specifications in this folder should be deleted or not.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
deleteFile()
Delete a file within this folder.
Parameters
- $fileName : string
The file name (in PDFDoc or UTF-16BE encoding) needs to be prefixed with the folder id.
Exceptions
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Merger\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getChilds()
Get files and folders in this folder.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getDescription()
Get the descriptive text associated with the file specification.
Parameters
- $encoding : string
getFile()
Get a file in this folder by its name in the embedded files name tree.
Parameters
- $name : string
Exceptions
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Merger\Exception
Throws \setasign\SetaPDF2\NotImplementedException
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getFiles()
Get all files in this folder.
Return Values
The keys are the names with which the files are registered in the embedded files name tree.
Exceptions
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
getId()
Get and/or create the folder id.
Exceptions
Throws \setasign\SetaPDF2\Merger\Exception
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\SecHandler\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getModificationDate()
Get the date of the most recent change to immediate child files or folders of this folder.
getParent()
Get a folder instance of the parent folder.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getSubfolder()
Get a folder by its name in UTF-8 encoding.
Parameters
- $name : string
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
getSubfolders()
Get all subfolders of this folder.
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception
setCollectionItem()
setCreationDate()
Set the date the folder was first created.
Parameters
- $creationDate : ?\DateTime
Exceptions
Throws \Exception
setDescription()
Set the descriptive text associated with the file specification.
Parameters
- $desc : ?string
- $encoding : string
setModificationDate()
Set the date of the most recent change to immediate child files or folders of this folder.
Parameters
- $creationDate : ?\DateTime
Exceptions
Throws \Exception
setParent()
Set a parent folder.
Parameters
- $parent : Folder
Exceptions
Throws \setasign\SetaPDF2\Core\Document\ObjectNotFoundException
Throws \setasign\SetaPDF2\Core\Exception
Throws \setasign\SetaPDF2\Core\Parser\Pdf\InvalidTokenException
Throws \setasign\SetaPDF2\Core\Reader\Exception
Throws \setasign\SetaPDF2\Core\Type\Exception
Throws \setasign\SetaPDF2\Core\Type\IndirectReference\Exception
Throws \setasign\SetaPDF2\Exception