SetaPDF_Core_Document_Info Class for handling the documents info dictionary
File: /SetaPDF v2/Core/Document/Info.php
Class hierarchy
Summary
Methods
- __construct()
- _extractParts()
- _getAllCustomMetadataKeys()
- _getDateValue()
- _getStringValue()
- _setStringValue()
- _syncAuthor()
- _syncCreationDate()
- _syncCreator()
- _syncCustomMetadata()
- _syncKeywords()
- _syncModDate()
- _syncProducer()
- _syncSubject()
- _syncTitle()
- _syncTrapped()
- cleanUp()
- getAll()
- getAllCustomMetadata()
- getAuthor()
- getCreationDate()
- getCreator()
- getCustomMetadata()
- getDictionary()
- getInfoDictionary()
- getKeywords()
- getMetadata()
- getModDate()
- getProducer()
- getSubject()
- getSyncMetadata()
- getTitle()
- getTrapped()
- getXmp()
- setAll()
- setAuthor()
- setCreationDate()
- setCreator()
- setCustomMetadata()
- setKeywords()
- setModDate()
- setProducer()
- setSubject()
- setSyncMetadata()
- setTitle()
- setTrapped()
- syncMetadata()
- updateXmp()
Constants
TRAPPED_FALSE
Value for the Trapped property
See
TRAPPED_TRUE
Value for the Trapped property
See
TRAPPED_UNKNOWN
Value for the Trapped property
See
Properties
$_metadata
The XMP metadata instance
$xmlAliases
Methods
__construct()
_extractParts()
Extracts single elements from a string and converts them into an array.
Parameters
- $value : string
_getDateValue()
Get a data value.
Parameters
- $name : string
- $asString : boolean
Exceptions
Throws Exception
_getStringValue()
Get a string value from the info dictionary.
Parameters
- $name : string
- $encoding : string
_setStringValue()
Set a string value in the info dictionary.
Parameters
- $name : string
- $value : string
- $encoding : string
Exceptions
_syncAuthor()
Syncs author with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncCreationDate()
_syncCreator()
Syncs creator with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncCustomMetadata()
Syncs custom metadata with the XMP metadata package.
Parameters
- $name : string
The name of the custom metadata
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncKeywords()
Syncs keywords with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncModDate()
_syncProducer()
Syncs producer with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncSubject()
Syncs subject with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncTitle()
Syncs title with XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
_syncTrapped()
Syncs the XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
getAll()
Get all data from the info dictionary.
Parameters
- $encoding : string
The output encoding
Return Values
An key/value array of all metadata.
getAuthor()
Get the name of the person who created the document.
Parameters
- $encoding : string
The output encoding
getCreationDate()
Get the date and time the document was created.
Parameters
- $asString : boolean
Exceptions
Throws Exception
getCreator()
Get the name of the product that created the original document from which it was converted.
Parameters
- $encoding : string
The output encoding
getCustomMetadata()
Get a custom metadata value.
Parameters
- $name : string
The name of the custom metadata value
- $encoding : string
The output encoding
getDictionary()
Get and/or creates the info dictionary.
Parameters
- $create : boolean
Defines if the dictionary should be created if it is not available
Return Values
The dictionary for low level access or null if none is available.
getInfoDictionary()
WARNING: This method is marked as deprecated!
Alias for getDictionary().
Parameters
- $create : boolean
Defines if the dictionary should be created if it is not available
Return Values
The dictionary for low level access or null if none is available.
getKeywords()
Get keywords associated with the document.
Parameters
- $encoding : string
The output encoding
getMetadata()
Get the metadata DOMDocument instance.
Return Values
Returns a DOMDocument instance of the XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
Throws Exception
getModDate()
Get the date and time the document was most recently modified.
Parameters
- $asString : bool
If set to true the string value will get returned. Otherwise a
SetaPDF_Core_DataStructure_Date
object.
Exceptions
Throws Exception
getProducer()
Get the name of the product that converted the original document to PDF.
Parameters
- $encoding : string
The output encoding.
getTrapped()
Get information whether the document has been modified to include trapping information.
Parameters
- $default : boolean
If set to true and no entry is defined the default value is returned
getXmp()
Get the XMP helper instance.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setAll()
Set all data via an array parameter.
This method decides if a value is a custom metadata or a standard value and will forward it to the desired method.
Parameters
- $data : array
An key/value array of metadata
- $encoding : string
The input encoding
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setAuthor()
Set the name of the person who created the document.
Parameters
- $author : string
The name of the person who created the document
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setCreationDate()
Set the date and time the document was created.
Parameters
- $date : string|DateTime|SetaPDF_Core_DataStructure_Date
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws Exception
setCreator()
Set the name of the product that created the original document from which it was converted.
Parameters
- $creator : string
The creator
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setCustomMetadata()
Set custom metadata.
Pass $value as null to remove this entry from the info dictionary.
Parameters
- $name : string
The name of the custom metadata
- $value : string
The string value of the custom metadata
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws InvalidArgumentException
Throws SetaPDF_Core_Type_Exception
setKeywords()
Set keywords associated with the document.
Parameters
- $keywords : string
The keywords associated with the document.
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setModDate()
Set the date and time the document was most recently modified.
Parameters
- $date : string|DateTime|SetaPDF_Core_DataStructure_Date
The modification date
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws Exception
setProducer()
Set the name of the product that converted the original document to PDF.
Parameters
- $producer : string
The name of the producer
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setSubject()
Set the subject of the document.
Parameters
- $subject : string
The subject of the document
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setSyncMetadata()
Defines if the XMP metadata should be synced automatically.
If this is set, the changes are made to a DOMDocument instance temporary. A call of syncMetadata() is required to write the changes to the metadata entry in the documents catalog dictionary.
Parameters
- $syncMetadata : bool
The flag status
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
setTitle()
Set the document's title.
Parameters
- $title : string
The document's title
- $encoding : string
The input encoding
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
setTrapped()
Set information whether the document has been modified to include trapping information.
Pass null or SetaPDF_Core_Document_Info::TRAPPED_UNKNOWN to remove this entry from the info dictionary.
Parameters
- $trapped : string
The trapped value. See
SetaPDF_Core_Document_Info::TRAPPED_XXX
constants.
Return Values
Returns the SetaPDF_Core_Document_Info
object for method chaining.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
syncMetadata()
Passes the changes to the XMP metadata package.
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception
updateXmp()
Updates a single field in the XMP package.
Parameters
- $namespace : string
The namespace of the element
- $tagName : string
The tag name
- $value : bool|string|array
The value
Exceptions
Throws SetaPDF_Core_SecHandler_Exception
Throws SetaPDF_Core_Type_Exception