| com.pspdfkit.document.metadata.DocumentXmpMetadata |
This class allows you to modify a PDF documents metadata.
Metadata is defined in two ways in the PDF spec (ยง 14.3):
- A metadata stream containing XMP data. This class is handling this. (https://en.wikipedia.org/wiki/Extensible_Metadata_Platform)
- The Info PDF dictionary. See DocumentPdfMetadata.
Use getXmpMetadata() to retrieve an instance of this class.
| Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| String | XMP_DC_NAMESPACE | Specifies the default Adobe DC namespace | |||||||||
| String | XMP_DC_NAMESPACE_PREFIX | Specifies the default Adobe DC namespace prefix | |||||||||
| String | XMP_PDF_NAMESPACE | Specifies the default Adobe PDF namespace | |||||||||
| String | XMP_PDF_NAMESPACE_PREFIX | Specifies the default Adobe PDF namespace prefix | |||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| abstract PdfValue |
get(String key, String xmlNamespace)
Retrieves a single metadata value from the XMP metadata entries included in the PDF file.
| ||||||||||
| abstract boolean |
hasUnsavedChanges()
Returns
true if there were any changes to the XMP metadata without save. | ||||||||||
| abstract void |
set(String key, String value, String namespace, String namespacePrefix)
Sets a single metadata value inside the XMP metadata structure in PDF.
| ||||||||||
Specifies the default Adobe DC namespace
Specifies the default Adobe DC namespace prefix
Specifies the default Adobe PDF namespace
Specifies the default Adobe PDF namespace prefix
Retrieves a single metadata value from the XMP metadata entries included in the PDF file.
| key | Metadata key, must not be null. |
|---|---|
| xmlNamespace | XML namespace the key belongs to. |
PdfValue instance representing a value or null. In most cases this will be a string, but nested arrays are also possible.
Returns true if there were any changes to the XMP metadata without save.
true if XMP metadata was changed, false otherwise.
Sets a single metadata value inside the XMP metadata structure in PDF. This should be preferred for freeform tags and data instead of
modifying the PDF metadata dictionary with set(String, PdfValue).
| key | Key for the metadata entry, must not be null. |
|---|---|
| value | Value for the entry, can be null. |
| namespace | XML namespace to which the entry belongs. For custom data use a custom namespace to avoid collisions with other applications writing the metadata. |
| namespacePrefix | XML namespace prefix/shorthand used in the XML structure. E.g. dc for Adobe DC namespace.
|