How to Import FDF into a PDF form
The Syncfusion Essential® PDF is a comprehensive, high-performance .NET PDF library that enables you to create, read, and edit PDF documents. Using this library, you can load an FDF file in the FileStream, then import the FDF stream data into the PdfLoadedForm.
Steps to Import FDF Data into a PDF Form
- Create a new console application project.
- Install the Syncfusion.Pdf.Net.Core NuGet package as a reference in your console application from NuGet.org.
- Include the following namespaces in the Program.cs file.
C#
using Syncfusion.Pdf.Parsing;
- Use the following code sample in Program.cs to import FDF into a PDF form.
C#
// Get stream from an existing PDF document.
FileStream docStream = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read);
// Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
// Get stream from an existing FDF document.
FileStream fdfStream = new FileStream("ImportFDF.fdf", FileMode.Open, FileAccess.Read);
// Import the FDF stream.
loadedDocument.Form.ImportDataFDF(fdfStream, true);
// Save the document into a stream.
MemoryStream stream = new MemoryStream();
loadedDocument.Save(stream);
// Close the document.
loadedDocument.Close(true);
By executing the program, you will generate the following PDF document.
Take a moment to peruse the documentation to learn how to add form fields in a PDF document.
Conclusion
I hope you enjoyed learning how to import FDF data into a PDF form.
You can refer to our ASP.NET Core PDF feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our ASP.NET Core PDF example to understand how to create and manipulate data.
For current customers, you can check out our 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 other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums or feedback portal. We are always happy to assist you!