Class XmpWriter

java.lang.Object
com.itextpdf.text.xml.xmp.XmpWriter
Direct Known Subclasses:
PdfAXmpWriter

public class XmpWriter extends Object
With this class you can create an Xmp Stream that can be used for adding Metadata to a PDF Dictionary. Remark that this class doesn't cover the complete XMP specification.
  • Field Details

  • Constructor Details

  • Method Details

    • getXmpMeta

      public XMPMeta getXmpMeta()
    • setReadOnly

      public void setReadOnly()
      Sets the XMP to read-only
    • setAbout

      public void setAbout(String about)
      Parameters:
      about - The about to set.
    • addRdfDescription

      @Deprecated public void addRdfDescription(String xmlns, String content) throws IOException
      Deprecated.
      Adds an rdf:Description.
      Parameters:
      xmlns -
      content -
      Throws:
      IOException
    • addRdfDescription

      @Deprecated public void addRdfDescription(XmpSchema s) throws IOException
      Deprecated.
      Adds an rdf:Description.
      Parameters:
      s -
      Throws:
      IOException
    • setProperty

      public void setProperty(String schemaNS, String propName, Object value) throws XMPException
      Parameters:
      schemaNS - The namespace URI for the property. Has the same usage as in getProperty.
      propName - The name of the property. Has the same usage as in getProperty().
      value - the value for the property (only leaf properties have a value). Arrays and non-leaf levels of structs do not have values. Must be null if the value is not relevant.
      The value is automatically detected: Boolean, Integer, Long, Double, XMPDateTime and byte[] are handled, on all other toString() is called.
      Throws:
      XMPException - Wraps all errors and exceptions that may occur.
    • appendArrayItem

      public void appendArrayItem(String schemaNS, String arrayName, String value) throws XMPException
      Simplifies the construction of an array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.
      Parameters:
      schemaNS - The namespace URI for the array.
      arrayName - The name of the array. May be a general path expression, must not be null or the empty string.
      value - the value of the array item.
      Throws:
      XMPException - Wraps all errors and exceptions that may occur.
    • appendOrderedArrayItem

      public void appendOrderedArrayItem(String schemaNS, String arrayName, String value) throws XMPException
      Simplifies the construction of an ordered array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.
      Parameters:
      schemaNS - The namespace URI for the array.
      arrayName - The name of the array. May be a general path expression, must not be null or the empty string.
      value - the value of the array item.
      Throws:
      XMPException - Wraps all errors and exceptions that may occur.
    • appendAlternateArrayItem

      public void appendAlternateArrayItem(String schemaNS, String arrayName, String value) throws XMPException
      Simplifies the construction of an alternate array by not requiring that you pre-create an empty array. The array that is assigned is created automatically if it does not yet exist. Each call to appendArrayItem() appends an item to the array.
      Parameters:
      schemaNS - The namespace URI for the array.
      arrayName - The name of the array. May be a general path expression, must not be null or the empty string.
      value - the value of the array item.
      Throws:
      XMPException - Wraps all errors and exceptions that may occur.
    • serialize

      public void serialize(OutputStream externalOutputStream) throws XMPException
      Flushes and closes the XmpWriter.
      Throws:
      IOException
      XMPException
    • close

      public void close() throws IOException
      Flushes and closes the XmpWriter.
      Throws:
      IOException
    • addDocInfoProperty

      public void addDocInfoProperty(Object key, String value) throws XMPException
      Throws:
      XMPException