Class DocumentPart

  • All Implemented Interfaces:

    public class DocumentPart
    extends Object
    A DocumentPart represents a contiguous list of pages from a PDF. It's primarily used when combining multiple files into one for printing, or for other special purposes, such as PDF/mail. It is a new concept in PDF 2.0
    See Also:
    PDFPage.getDocumentPart(), PDF.getDocumentPart()
    • Constructor Detail

      • DocumentPart

        public DocumentPart()
        Create a new DocumentPart
    • Method Detail

      • getParent

        public DocumentPart getParent()
        Return the parent DocumentPart if this object has one, or null if it is the root or is not yet connected to a tree
        the parent DocumentPart
      • getPages

        public List<PDFPage> getPages()
        Return the list of pages that are included in this Document Part. The list is contiguous - it matches a sublist of PDF.getPages(). When adding or removing items to it, the list must be contiguous at all times. A DocumentPart cannot have both Pages and DocumentParts at the same time. Pages cannot be added to a DocumentPart until it's been added to a PDF
        an editable list of pages
      • getDocumentParts

        public List<DocumentPart> getDocumentParts()
        Return the list of child DocumentParts that belong to this DocumentPart. The list is modifiable, but DocumentParts cannot belong to more than one parent at a time. A DocumentPart cannot have both Pages and DocumentParts at the same time.
      • getAssociatedFiles

        public Collection<EmbeddedFile> getAssociatedFiles()
        Return the list of embedded files assocatiated with this object. The list is live and can be edited.
      • getXMP

        public XMP getXMP()
        Return an XMP Metadata object representing any XML metadata associated with this object
        the XMP, which may be empty or invalid but will never be null
      • isEmpty

        public boolean isEmpty()
        Return true if this DocumentPart has no pages and no child DocumentParts
      • isLeaf

        public boolean isLeaf()
        Return true if this DocumentPart does not contain child DocumentParts
      • setProperties

        public void setProperties​(Map<String,​Object> properties)
        Set the properties (called the "Document Part Metadata Dictionary" in the spec). The supplied Map should contain only the values described in getProperties(), anything else will be ignored. A value of null will remove the properties
        properties - the Document Part Metadata properties
      • toString

        public String toString()
      • putLiteral

        public void putLiteral​(String key,
                               String tokens)
        Put a literal token sequnce. For debugging
        key - the key
        tokens - the token sequence, eg "true" or "/foo" or "[/Foo/Bar]". No refs, just direct objects.