We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Finding form fields of a specific page

Hi everybody,

I want to get the form fields placed on a specific page. But only the PdfDocument class has the Form.Fields collection I have to loop through comparing the PdfField.Page property with another PdfPage object to get to know on which page the PdfField is placed.

I need something like that:

foreach (PdfField field in pdfPage.Form.Fields)
{
...
}

At the moment I have to loop through the whole PdfDocument to find fields of a specific (2nd) page:

foreach (PdfField field in pdfDocument.Form.Fields)
{
if (pdfDocument.Pages.IndexOf(field.Page) == 1)
break;
}

Regards


5 Replies

GL George Livingston Syncfusion Team January 27, 2012 12:54 PM UTC

Hi Guido,

Thank you for using Syncfusion products.

Currently we do not have support to get the form field for the specific page. However we have added a feature request for this implementation. We will let you know once the feature has been implemented. For further follow can you please create a Direct-Trac incident.

Please let us know if you have any questions.

Regards,
George




TJ Todd J February 13, 2018 04:16 PM UTC

Hi George;
Is the there way to find page number of a form field?
Thanks


SL Sowmiya Loganathan Syncfusion Team February 14, 2018 12:07 PM UTC

Hi Guido, 

We can get the page number of a form field in the PDF document. Please refer the below code snippet for more details: 

            //Load the PDF document. 
            PdfLoadedDocument document = new PdfLoadedDocument("Form.pdf"); 
 
            //Get all the form fields. 
            PdfLoadedForm loadedForm = document.Form; 
            PdfLoadedFormFieldCollection fieldCollection = loadedForm.Fields; 
 
            //Check the page number of the field. 
            foreach (PdfLoadedField field in fieldCollection) 
            { 
                for (int i = 0; i < document.Pages.Count; i++) 
                { 
                    if (field.Page == document.Pages[i]) 
                    { 
                        Console.WriteLine(field.Name + " - Page no is " + (i + 1)); 
                    } 
                } 
            } 


We have created the sample for the same. Please find the sample link from below: 

Please try the above sample in your end and let us know if it meets your requirement. If not please let us know the further details regarding your requirements. It will be helpful for us to analyze further and assist you better. 

Regards, 
Sowmiya L 



TN Tarek Najem February 24, 2021 01:09 AM UTC

Hello,

First I would like to thank you for this great product.
But I would like to let you know that we will soon celebrate the 10th birthday for this question, but unfortunately so far this feature has not been added.

Regards
T. Najem


GK Gowthamraj Kumar Syncfusion Team February 24, 2021 12:07 PM UTC

Hi Tarek,    
  
Sorry for the inconvenience caused.   
  
It is not possible to provide support to get the form field for the specific page by using the Syncfusion PDF library. In our PDF library, form fields are kept inside the PDF document catalog, so we can get form fields from PDF documents. Then only, we can find their related annotation mapped in a PDF page and even single form fields can map in different pages so that we could not provide this feature on our end.   

Regards,  
Gowthamraj K 


Loader.
Live Chat Icon For mobile
Up arrow icon