Class PDFLogicalStructureHandler


  • public class PDFLogicalStructureHandler
    extends java.lang.Object
    Handles the creation of the logical structure in the PDF document.
    • Field Detail

      • MCR

        private static final PDFName MCR
      • OBJR

        private static final PDFName OBJR
      • parentTreeKey

        private int parentTreeKey
      • currentPage

        private PDFPage currentPage
      • pageParentTreeArray

        private PDFArray pageParentTreeArray
        The array of references, from marked-content sequences in the current page, to their parent structure elements. This will be a value in the structure parent tree, whose corresponding key will be the page's StructParents entry.
    • Constructor Detail

      • PDFLogicalStructureHandler

        PDFLogicalStructureHandler​(PDFDocument pdfDoc)
        Creates a new instance for handling the logical structure of the given document.
        Parameters:
        pdfDoc - a document
    • Method Detail

      • getPageParentTree

        public PDFArray getPageParentTree()
      • getNextParentTreeKey

        public int getNextParentTreeKey()
      • startPage

        void startPage​(PDFPage page)
        Receive notification of the beginning of a new page.
        Parameters:
        page - the page that will be rendered in PDF
      • endPage

        void endPage()
        Receive notification of the end of the current page.
      • addTextContentItem

        PDFLogicalStructureHandler.MarkedContentInfo addTextContentItem​(PDFStructElem structElem)
        Adds a content item corresponding to text into the structure tree, if there is a structure element associated to it.
        Parameters:
        structElem - the parent structure element of the piece of text
        Returns:
        the necessary information for bracketing the content as a marked-content sequence. If there is no element in the structure tree associated to that content, returns an instance whose PDFLogicalStructureHandler.MarkedContentInfo.tag value is null. The content must then be treated as an artifact.
      • addImageContentItem

        PDFLogicalStructureHandler.MarkedContentInfo addImageContentItem​(PDFStructElem structElem)
        Adds a content item corresponding to an image into the structure tree, if there is a structure element associated to it.
        Parameters:
        structElem - the parent structure element of the image
        Returns:
        the necessary information for bracketing the content as a marked-content sequence. If there is no element in the structure tree associated to that image, returns an instance whose PDFLogicalStructureHandler.MarkedContentInfo.tag value is null. The image must then be treated as an artifact.
      • addLinkContentItem

        void addLinkContentItem​(PDFLink link,
                                PDFStructElem structureTreeElement)
        Adds a content item corresponding to the given link into the structure tree.
        Parameters:
        link - a link
        structureTreeElement - its parent structure element