Class DocumentPart

  • All Implemented Interfaces:
    Cloneable

    public class DocumentPart
    extends Object
    A DocumentPart represents a contiguous list of pages from a PDF. Its 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
    Since:
    2.28.3
    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
        Returns:
        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
        Returns:
        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.
      • 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
        Parameters:
        properties - the Document Part Metadata properties
      • toString

        public String toString()