Skip to content

0.1.12 regression: PdfDocument.TryGetForm doesn't find any forms #1208

@cremor

Description

@cremor

I found a regression in version 0.1.12. It seems like PdfDocument.TryGetForm never finds any forms (at least with the files that I tested).

Sample input files:
Input visible.pdf
Input invisible.pdf
(Note: I know that the digital signatures of those files are invalid. This is because they are only test signatures. They should be found anyway.)

Sample code:

using var pdf = PdfDocument.Open(InputFile);

if (!pdf.TryGetForm(out AcroForm form))
{
    Console.WriteLine("ERROR: No AcroForm found");
    return;
}

var signatureFields = form
   .Fields
   .Where(x => x.FieldType == AcroFieldType.Signature)
   .ToArray();

if (signatureFields.Length == 0)
{
    Console.WriteLine("ERROR: No Signature field found");
    return;
}

foreach (var field in signatureFields)
{
    Console.WriteLine("Signature field found: " + field.Information.PartialName);
}

Expected output:
Signature field found: Signature1

Actual output:
ERROR: No AcroForm found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions