pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Get list of PDPageLabelRange?
Date Tue, 25 Apr 2017 16:43:21 GMT
Am 25.04.2017 um 14:15 schrieb Olivier Cailloux:
> Le 24/04/2017 à 20:10, Tilman Hausherr a écrit :
>> 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?
> Thanks for your reply. I need the ranges.
>> First one isn't available for some reason. There's a Map<Integer, 
>> PDPageLabelRange> labels, but it is not available to the public.
> Should I file a request for improving this situation somehow?
> Olivier

I'm wondering whether it is really THAT important? I'm not sure if I 
should expose the map; maybe return a list of pages as a set? You could 
then iterate on that one to get the ranges.


To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message