Filling data in PDF continuation pages
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:
- Syncfusion.Pdf.Base.dll
- 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
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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!