Class XmpWriter

  • All Implemented Interfaces:
    AutoCloseable

    public class XmpWriter
    extends Object
    implements AutoCloseable
    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 Detail

      • XPACKET_PI_BEGIN

        public static final String XPACKET_PI_BEGIN
        Processing Instruction required at the start of an XMP stream
        Since:
        iText 2.1.6
        See Also:
        Constant Field Values
      • XPACKET_PI_END_W

        public static final String XPACKET_PI_END_W
        Processing Instruction required at the end of an XMP stream for XMP streams that can be updated
        Since:
        iText 2.1.6
        See Also:
        Constant Field Values
      • XPACKET_PI_END_R

        public static final String XPACKET_PI_END_R
        Processing Instruction required at the end of an XMP stream for XMP streams that are read only
        Since:
        iText 2.1.6
        See Also:
        Constant Field Values
      • extraSpace

        protected int extraSpace
        You can add some extra space in the XMP packet; 1 unit in this variable represents 100 spaces and a newline.
      • writer

        protected OutputStreamWriter writer
        The writer to which you can write bytes for the XMP stream.
      • about

        protected String about
        The about string that goes into the rdf:Description tags.
      • end

        protected char end
        The end attribute.
    • Method Detail

      • setReadOnly

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

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

        public void addRdfDescription​(String xmlns,
                                      String content)
                               throws IOException
        Adds an rdf:Description.
        Parameters:
        xmlns - xml namespace
        content - content
        Throws:
        IOException - on error
      • addRdfDescription

        public void addRdfDescription​(XmpSchema s)
                               throws IOException
        Adds an rdf:Description.
        Parameters:
        s - xmp schema
        Throws:
        IOException - on error