Am 24.04.2017 um 14:53 schrieb Olivier Cailloux:
Dear list,
How can I obtain, from a given PDDocument, a list of the page label ranges that it contains?

Here is an example where I obtain the first PDPageLabelRange. How to retrieve the other ones? I realize I can iterate over all pages of the document and query for the possible existence of a pageLabelRange at each page, but I suspect there must be a more efficient (and simpler) way.

try (PDDocument document = PDDocument.load(…)) {
    assert !document.isEncrypted();
    PDDocumentCatalog catalog = document.getDocumentCatalog();
    PDPageLabels labels = catalog.getPageLabels();
    PDPageLabelRange pageLabelRange = labels.getPageLabelRange(0);
}

[accidentally mailed; repost for the list]

Do you need the range (which is a naming scheme) or do you need the label? Last one would be easy.

      labels.getLabelsByPageIndices();

First one isn't available for some reason. There's a Map<Integer, PDPageLabelRange> labels, but it is not available to the public.

Tilman

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to