PDFRasterizer.NET 4.0 is now available. Supports .NET Core. Renders pixel-perfectly.

Export FDF from PDF form

This code sample helps to exports FDF from PDF.

With PDFs it is possible to export the filled-in form data seperately from the PDF document itself. This format is called FDF (Form Data Format) and can be used for quick data processing and storage in databases. In this code sample you can see how you can create it from a PDF document.

using ( FileStream pdfFile = new FileStream( @"..\..\..\inputDocuments\fw4.pdf", FileMode.Open, FileAccess.Read ) )
{
    Document document = new Document( pdfFile );

    TextField firstName = document.Fields[ "f1_09(0)" ] as TextField;
    firstName.Value = "Chris";

    TextField lastName = document.Fields[ "f1_10(0)" ] as TextField;
    lastName.Value = "Sharp";

    FdfFormData fdf = document.Export(SubmitFormat.Fdf, false) as FdfFormData;
    fdf.Path = "fw4.pdf";
            
    using ( FileStream fdfFile = new FileStream( @"..\..\fw4.fdf", FileMode.Create, FileAccess.Write ) )
    {
    fdf.Write( fdfFile );
    }
}
Using pdfFile As New FileStream("..\..\..\inputDocuments\fw4.pdf", FileMode.Open, FileAccess.Read)
	Dim document As New Document(pdfFile)

	Dim firstName As TextField = TryCast(document.Fields("f1_09(0)"), TextField)
	firstName.Value = "Chris"

	Dim lastName As TextField = TryCast(document.Fields("f1_10(0)"), TextField)
	lastName.Value = "Sharp"

	Dim fdf As FdfFormData = TryCast(document.Export(SubmitFormat.Fdf, False), FdfFormData)
	fdf.Path = "fw4.pdf"

	Using fdfFile As New FileStream("..\..\fw4.fdf", FileMode.Create, FileAccess.Write)
		fdf.Write(fdfFile)
	End Using
End Using
Download PDFKit.NET 5.0
We will send you a download link

  • This field is for validation purposes and should be left unchanged.
Why do we ask your email address?
We send tips that speed up your evaluation
We let you know about bug fixes
You can always unsubscribe with one click
We never share your address with a 3rd party
Thank you for your download

We have sent an email with a download link.