How to fill reader extended PDF file using C# and VB.NET
Syncfusion Essential PDF is a .NET PDF library used to create, read, and edit PDF documents. Using this library, you can fill the reader extended PDF file using C# and VB.NET.
Extending Features in Adobe Reader can be enabled only using Adobe Acrobat or Adobe LiveCycle Reader Extensions ES. This extension is provided by Adobe to its reader application for a document. This standard will not be published for third party PDF creators and hence, it cannot be done without Adobe. However, support has been provided to fill reader extended PDF file.
Fill the reader extended PDF document by using the following steps:
- Load the extended featured document that is created in Adobe Acrobat using Essential PDF.
- Edit the PDF document by filling form fields.
- Save the PDF document (Extended rights preserved).
Steps to fill reader extended PDF file programmatically:
- Create a new C# console application project.
- Install the Syncfusion.Pdf.WinForms NuGet package as reference to your .NET Framework application from NuGet.org.
- Include the following namespaces in the Program.cs file.
C#
using Syncfusion.Pdf.Parsing;
VB.NET
Imports Syncfusion.Pdf.Parsing
- Use the following code snippet to fill the reader extended PDF file.
C#
//Load the PDF document PdfLoadedDocument loadedDocument = new PdfLoadedDocument("ExtendedFeaturedForm.pdf") //Get the loaded form PdfLoadedForm loadedForm = loadedDocument.Form; loadedForm.SetDefaultAppearance(false); //Get the loaded form field and modify the properties PdfLoadedTextBoxField loadedTextBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField; loadedTextBoxField.Text = "Simons"; PdfLoadedTextBoxField loadedTextBoxField1 = loadedForm.Fields[0] as PdfLoadedTextBoxField; loadedTextBoxField1.Text = "Bistro"; PdfLoadedTextBoxField loadedTextBoxField2 = loadedForm.Fields[0] as PdfLoadedTextBoxField; loadedTextBoxField2.Text = "simonsbistro@outlook.com"; loadedDocument.Save("Sample.pdf"); loadedDocument.Close(true); //This will open the PDF file so, the result will be seen in default PDF Viewer Process.Start("Sample.pdf");
VB.NET
'Load the PDF document Dim loadedDocument As New PdfLoadedDocument("ExtendedFeaturedForm.pdf") 'Get the loaded form Dim loadedForm As PdfLoadedForm = loadedDocument.Form loadedForm.SetDefaultAppearance(False) 'Get the loaded form field and modify the properties Dim loadedTextBoxField As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(0), PdfLoadedTextBoxField) loadedTextBoxField.Text = "Simons" Dim loadedTextBoxField1 As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(0), PdfLoadedTextBoxField) loadedTextBoxField1.Text = "Bistro" Dim loadedTextBoxField2 As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(0), PdfLoadedTextBoxField) loadedTextBoxField2.Text = "simonsbistro@outlook.com" loadedDocument.Save("Sample.pdf") loadedDocument.Close(True) 'This will open the PDF file so, the result will be seen in default PDF Viewer Process.Start("Sample.pdf")
A complete working sample can be downloaded from PDFSample.zip.
By executing the program, you will get the PDF document as follows.
Take a moment to peruse the documentation, where you can find options like form fields to PDF, modifying existing form fields, filling form fields, removing and editing capability, removing form fields, importing FDF file to PDF, exporting PDF file to FDF, adding actions to form fields, and features like XFA Form and annotation with code examples.
Refer here to explore PDF forms in Syncfusion Essential PDF.
Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.