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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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 be null.
        value - Value for the entry, can be null.
        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.