Get Print Page Range from PDF

We have a need to retrieve the Print Page Range setting from a PDF using Aspose.PDF for Java. For reference, I’m talking about this value when viewing Properties in Adobe PDF Reader:
image.jpg (92.6 KB)
We’re using a trial version of Aspose.PDF Java 19.2 and haven’t been able to accomplish this. Unfortunately, we need to make sure this works before we can convince management to authorize a purchase.

We’ve tried the following:

  1. Retrieving the PDF’s ViewerPreferences object using Document.getCatalogValue, then retrieving the Print Page Range setting from there. We were able to find the object ID for Print Page Range (1812 in this case), but we were not able to find the actual value in the Object returned by getCatalogValue, nor was Document.getObjectById able to return the actual value using the ID.

  2. Using PdfViewer and retrieving the value from PdfViewer.getDefaultPrinterSettings().getPageRange() (or getToPage(), getFromPage(), etc.). None of the above resulted in the correct values. getToPage() always returned 11 despite the correct To value being 6. Page Range returned a 0, which makes no sense - I’d expect it to be either an array of page numbers or equal to getToPage() - getFromPage(). It is neither.

  3. Traversing the PDF’s LogicalStructure to find the PDF Object containing the Page Range. The object did not appear anywhere in any of the three trees we tried (Document.getLogicalStructure, Document.getTaggedContent.getRootElement, and Document.getTaggedContent.getStructuredRootElement).

As you can see, we’ve given this a lot of effort. Would love it if we could get some help.

@jpf

Thank you for contacting support.

We have been able to notice the problem while extracting page range. Therefore, a ticket with ID PDFJAVA-38461 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.