How to Read PDF Form Fields in C#


I have a simple PDF, trying to read the fields of the form using .NET version of the library. Here is the PDF file.

OoPdfFormExample.pdf (64.2 KB)

below is the same code, the fields collection has just 4 fields, but the form has 17 different fields.

          Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(dataDir + "OoPdfFormExample.pdf");

        Aspose.Pdf.Forms.Field[] fields = pdfDocument.Form.Fields;

        // Get values from all fields
        foreach (Aspose.Pdf.Forms.Field f in fields)
            Response.Write("Field Name: " + f.FullName);
            Response.Write("<br />");
            Response.Write("Value: " + f.Value);
            Response.Write("<br />");
            Response.Write("<br />");

Can you please help with the solution?



It looks like a restriction of evaluation version of the API. Would you please make sure that you are using the API with a valid license or a 30-days free temporary license? Please note that API can only process 4 elements of any collection in a PDF in evaluation mode. In order to use the API in its full capacity, a valid license is needed. Please set the license before reading the PDF form fields and let us know in case you still face any issues.

You are right, Thank you for the help!

1 Like