Why are the AcroFields in my document empty?

I have a PDF form with filled out fields. I can change the values and save them. But when I try to read the AcroFields, they are empty.

var reader = new PdfReader((DataContext as PDFContext).Datei);
AcroFields form = reader.AcroFields;
txt.Text = GetFormFieldNamesWithValues(reader);
private static string GetFormFieldNamesWithValues(PdfReader pdfReader) {
    return string.Join("\r\n", pdfReader.AcroFields.Fields
        .Select(x => x.Key + "=" +
How can I read the fields?

Posted on StackOverflow on Apr 7, 2014 by Gregor Glinka

Clearly your PDF is broken. The fields are defined as widget annotations on the page level, but they aren't referenced in the /AcroForm fields set on the document root level.

You can fix your PDF using this code sample:

PdfReader reader = new PdfReader(src);
PdfDictionary root = reader.getCatalog();
PdfDictionary form = root.getAsDict(PdfName.ACROFORM);
PdfArray fields = form.getAsArray(PdfName.FIELDS);
PdfDictionary page;
PdfArray annots;
for (int i = 1; i <= reader.getNumberOfPages(); i++) {
    page = reader.getPageN(i);
    annots = page.getAsArray(PdfName.ANNOTS);
    for (int j = 0; j < annots.size(); j++) {
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));

Or if you need this in C#:

PdfReader reader = new PdfReader(src);
PdfDictionary root = reader.Catalog;
PdfDictionary form = root.GetAsDict(PdfName.ACROFORM);
PdfArray fields = form.GetAsArray(PdfName.FIELDS);
PdfDictionary page;
PdfArray annots;
for (int i = 1; i <= reader.NumberOfPages; i++) {
    page = reader.GetPageN(i);
    annots = page.GetAsArray(PdfName.ANNOTS);
    for (int j = 0; j < annots.Size; j++) {
PdfStamper stamper = new PdfStamper(reader, new FileStream(dest, FileMode.Create));

You should inform the creators of the tool that was used to produce the form that their PDFs aren't compliant with the PDF reference.

Click this link if you want to see how to answer this question in iText 7.

Ready to use iText?

Try our iText 7 Library and add-ons FREE for 30 days. Test your proof of concept, and see if our solution is right for you.

Get my FREE trial

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now