Articles in this section
Category / Section

Filling data in PDF continuation pages

2 mins read

It is possible to fill field data in WinForms PDF continuous pages using TryGetField method in PdfFormFieldCollection class. It helps to get form fields from an existing document using the field name. It specifies whether the field is available by returning a Boolean value, and then the field is filled.

Assemblies Required:

  1. Syncfusion.Pdf.Base.dll
  2. Syncfusion.Compression.Base.dll

The below code illustrates how to fill data in PDF continuation Pages.

Code Snippet:

//Load the PDF document 
PdfLoadedDocument page1Document = new PdfLoadedDocument("../../Data/FormPage.pdf");
 
//Load the Continuous PDF document 
PdfLoadedDocument pageContinuationDocument = new PdfLoadedDocument("../../Data/FormContinuationPage.pdf");
 
//Gets the form field collection from Loaded document
PdfLoadedFormFieldCollection form = page1Document.Form.Fields;
            
//Gets the form field collection from Continuous document
PdfLoadedFormFieldCollection formContinuation = pageContinuationDocument.Form.Fields;
 
//Sets Field as PdfLoadedTextBoxField
PdfLoadedField FirstName = null;
if (form.TryGetField("FirstName", out FirstName))
{
     (FirstName as PdfLoadedTextBoxField).Text = "Andrew";
     (FirstName as PdfLoadedTextBoxField).ReadOnly = true;
}
 
PdfLoadedField LastName = null;
if (form.TryGetField("LastName", out LastName))
{
     (LastName as PdfLoadedTextBoxField).Text = "Fuller";
     (LastName as PdfLoadedTextBoxField).ReadOnly = true;
}
 
PdfLoadedField FirstNameContinuation = null;
if (formContinuation.TryGetField("FirstName", out FirstNameContinuation))
{
     (FirstNameContinuation as PdfLoadedTextBoxField).Text = "Andrew";
     (FirstNameContinuation as PdfLoadedTextBoxField).ReadOnly = true;
}
 
PdfLoadedField LastNameContinuation = null;
if (formContinuation.TryGetField("LastName", out LastNameContinuation))
{
     (LastNameContinuation as PdfLoadedTextBoxField).Text = "Fuller";
     (LastNameContinuation as PdfLoadedTextBoxField).ReadOnly = true;
}
 
//Creates new Pdf Document
PdfDocument doc = new PdfDocument();
            
//Append the Loaded document to new document and dispose it                  
doc.Append(page1Document);
page1Document.Close();
 
doc.Append(pageContinuationDocument);
pageContinuationDocument.Close();
 
//Sets the PdfDocument Form as Read only
doc.Form.ReadOnly = true;
 
//Save the document and dispose it
doc.Save("sample.pdf");
doc.Close(true);

 

The working sample can be downloaded from the link below:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/FillingData495448228

Conclusion

I hope you enjoyed learning about filling data in PDF continuation pages.

You can refer to our WinForms PDF’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms PDF documentation to understand how to present and manipulate data.

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms PDF and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied