Interface DocumentXmpMetadata
-
- All Implemented Interfaces:
public interface 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.
-
-
Method Summary
Modifier and Type Method Description abstract PdfValue
get(@NonNull() String key, @NonNull() String xmlNamespace)
Retrieves a single metadata value from the XMP metadata entries included in the PDF file. abstract void
set(@NonNull() String key, @Nullable() String value, @NonNull() String namespace, @NonNull() String namespacePrefix)
Sets a single metadata value inside the XMP metadata structure in PDF. abstract boolean
hasUnsavedChanges()
Returns true
if there were any changes to the XMP metadata without save.-
-
Method Detail
-
get
@Nullable() abstract PdfValue get(@NonNull() String key, @NonNull() String xmlNamespace)
Retrieves a single metadata value from the XMP metadata entries included in the PDF file.
- Parameters:
key
- Metadata key, must not be null.xmlNamespace
- XML namespace the key belongs to.- Returns:
a PdfValue instance representing a value or
null
. In most cases this will be a string, but nested arrays are also possible.
-
set
abstract void set(@NonNull() String key, @Nullable() String value, @NonNull() String namespace, @NonNull() String namespacePrefix)
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.
- Parameters:
key
- Key for the metadata entry, must not benull
.value
- Value for the entry, can benull
.namespace
- XML namespace to which the entry belongs.namespacePrefix
- XML namespace prefix/shorthand used in the XML structure.
-
hasUnsavedChanges
abstract boolean hasUnsavedChanges()
Returns
true
if there were any changes to the XMP metadata without save.- Returns:
true
if XMP metadata was changed,false
otherwise.
-
-
-
-