Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4323

Not able to determine the page (page number) of the some form fields

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: AcroForm, PDModel
    • Labels:
      None

      Description

      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:

      1. First I get list of all pages (as in 'PDPageTree') of pdf using 'pdDocumentCatalog.GetPages()'
      2. Then I get 'PDAcroForm' for the same pdf using 'getAcroForm()' method
      3. 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:

        

        var widgets = field.getWidgets();
        var widget = (widgets.toArray()[0] as PDAnnotationWidget);
        if (widget != null)
        {
              int pageNo = pages.indexOf(widget.getPage());  
        }
      

       

       

      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.

        Attachments

        1. fda-form-356h-Scrubbed.pdf
          3.40 MB
          Amit Maheshwari

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              aa.amit.mahheshwari Amit Maheshwari
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: