pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Maheshwari (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-4323) Not able to determine the page (page number) of the some form fields
Date Wed, 26 Sep 2018 03:56:00 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-4323?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16628228#comment-16628228

Amit Maheshwari commented on PDFBOX-4323:

Hello [~tilman]

I'm sorry but I could not understood your comment fully. Can you explain me it for my better



When you say for the code,
int pageNo = doc.getPages().indexOf(widget.getPage());
if (pageNo < 0)
 you got many results, but you could not find them on pages. what does that mean?


This gives me 5 pages. And as you said, yes, this pdf adds pages (or templates) as needed.
But when you say, "And it turned out that all pages < 0 are templates.".

But I can get the index of the page of widget of first three pages from this line
but not for those widget which are on 4th and 5th pages.


How come page 1,2, and 3 behave normal and having problem with just page 4, and 5.





> Not able to determine the page (page number) of the some form fields
> --------------------------------------------------------------------
>                 Key: PDFBOX-4323
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4323
>             Project: PDFBox
>          Issue Type: Bug
>          Components: AcroForm, PDModel
>    Affects Versions: 2.0.2
>            Reporter: Amit Maheshwari
>            Priority: Major
>         Attachments: fda-form-356h-Scrubbed.pdf
> I am not able to decide the page number of some form fields (specially of page 4, 5 of
attached pdf).
> How I'm trying to get page number:
>  # First I get list of all pages (as in 'PDPageTree') of pdf using 'pdDocumentCatalog.GetPages()'
>  # Then I get 'PDAcroForm' for the same pdf using 'getAcroForm()' method
>  # Then I get list of all Fields (as in 'PDFieldTree') from previously got AcroForm
> I use all these information in following code to get Page Number:
> {code:java}
>   var widgets = field.getWidgets();
>   var widget = (widgets.toArray()[0] as PDAnnotationWidget);
>   if (widget != null)
>   {
>         int pageNo = pages.indexOf(widget.getPage());  
>   }
> {code}
> There is no error, just I am getting pageNo = -1 (as list doesn't contain such page)
> But for some fields, list of pages doesn't contain the page which I get from 'widget.getPage()' 
> Let me know if some more clarification required.

This message was sent by Atlassian JIRA

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

View raw message