These sample source codes can be used to convert PDF to XFDF (XML version of the “Forms Data Format (FDF)” specification) in C#, VB.NET, and VBScript using ByteScout PDF Extractor SDK.

Select your programming language:

How to convert PDF to XFDF in C#

using System;
using System.Collections.Generic;
using System.Text;
using Bytescout.PDFExtractor;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create Bytescout.PDFExtractor.XFDFExtractor instance
            XFDFExtractor extractor = new XFDFExtractor();
            extractor.RegistrationName = "demo";
            extractor.RegistrationKey = "demo";

            // Load sample PDF document
            extractor.LoadDocumentFromFile("sample3.pdf");

            extractor.SaveXFDFToFile("output.xml");

            Console.WriteLine();
            Console.WriteLine("Data has been extracted to 'output.xml' file.");
            Console.WriteLine();
            Console.WriteLine("Press any key to continue and open file in default associated application...");
            Console.ReadKey();
            Process.Start("output.xml");
        }
    }
}

How to convert PDF to XFDF in Visual Basic .NET

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Bytescout.PDFExtractor
Imports System.Diagnostics

Namespace ConsoleApplication1
    Class Program
        Shared Sub Main(ByVal args As String())
            ' Create Bytescout.PDFExtractor.XFDFExtractor instance
            Dim extractor As New XFDFExtractor()
            extractor.RegistrationName = "demo"
            extractor.RegistrationKey = "demo"

            ' Load sample PDF document
            extractor.LoadDocumentFromFile("sample3.pdf")

            extractor.SaveXFDFToFile("output.xml")

            Console.WriteLine()
            Console.WriteLine("Data has been extracted to 'output.xml' file.")
            Console.WriteLine()
            Console.WriteLine("Press any key to continue and open file in default associated application...")
            Console.ReadKey()

            Process.Start("output.xml")
        End Sub
    End Class
End Namespace

How to convert PDF to XFDF in VBScript (Visual Basic 6)

' Create Bytescout.PDFExtractor.XFDFExtractor object
Set extractor = CreateObject("Bytescout.PDFExtractor.XFDFExtractor")

extractor.RegistrationName = "demo"
extractor.RegistrationKey = "demo"

' Load sample PDF document
extractor.LoadDocumentFromFile "../../sample3.pdf"

extractor.SaveXFDFToFile "output.xml"

MsgBox "Data has been extracted to 'output.xml' file."