ceTe Software Help Library for Java August - 2020
DynamicPDF Merger for Java / Programming with Merger for Java / Reading Outline Information
In This Topic
    Reading Outline Information
    In This Topic

    When merging or appending PDF documents that already contain Outlines, the information within those outlines can be retrieved directly from PdfDocument object. Retrieving these Outline properties from the PdfDocument object is as easy as instantiating a PdfDocument object based on the PDF that you are merging or appending. That PdfDocument then will contain a collection of outlines that can be accessed directly.

    The below example demonstrates how to read the text and page number from an existing collection of outlines in a PdfDocument object and displays that information.

    [Java]
        PdfDocument pdfDocument = new PdfDocument( "[PhysicalPath]\Test.pdf" );
        for ( int i = 0; i<pdfDocument.getOutlines().size(); i++ ) {
            System.out.println( pdfDocument.getOutlines().getPdfOutline(i).getText() +
            ":"+ pdfDocument.getOutlines().getPdfOutline(i).getTargetPageNumber() ); }