Reading Form fields failes when the pdf contains one ore more signatures

We are exporting the values of form fields, which is working perfect as long the document we process does not contain signatures.

If a document is signed, we receive the following exception, when we access the fields property:

var doc = new Document(new MemoryStream(content));
foreach (var field in doc.Forms.Fields) {…}

An attempt was made to move the position before the beginning of the stream.
Log
An attempt was made to move the position before the beginning of the stream.
at System.IO.MemoryStream.Seek(Int64 offset, SeekOrigin loc)
at #=zyZ6tZ6UcBtdU82oFB7JkEofNSuGJy82FDc5G5HxVRcd$.#=zsd7hOIg=(Int64 #=zO$h_lgs=, SeekOrigin #=zqIt78U4=)
at #=zyaCnUIOQ2a9lZA_lmyvaT0xPa$qd$7xXLw==.#=zjz3ey7E=(Byte[] #=zQx5Cl8c=, Int32 #=zO$h_lgs=, Int32 #=zQ$HyLnU=, Int32 #=zBW0rfIM=)
at #=zV7svFHCgDIEG9ZsT701t1f8LTroLM46XZwEUm8h4KF8Q1TWGjsG4bXYqEYZPe8e7xU0h0L1o9bxgnnbCnw==.#=zb8vq1FQ=(#=z69maIet4C$Ajhi5X5X1aSBiLEDxmW81TUw== #=zJ2V8XNc=, #=z8wqS1dWSpWKq8A6I3_EnVVn2nazr #=z$00Vl5g=)
at Aspose.Pdf.Forms.Signature.#=zy3umWHxBj7BHgOMGwQvcpMg=(#=z69maIet4C$Ajhi5X5X1aSBiLEDxmW81TUw== #=zJ2V8XNc=, #=z8wqS1dWSpWKq8A6I3_EnVVn2nazr #=z$00Vl5g=)
at Aspose.Pdf.Forms.Signature…ctor(#=z69maIet4C$Ajhi5X5X1aSBiLEDxmW81TUw== #=zJ2V8XNc=, #=z8wqS1dWSpWKq8A6I3_EnVVn2nazr #=z$00Vl5g=)
at Aspose.Pdf.Forms.PKCS7Detached…ctor(#=z69maIet4C$Ajhi5X5X1aSBiLEDxmW81TUw== #=zJ2V8XNc=, #=z8wqS1dWSpWKq8A6I3_EnVVn2nazr #=z$00Vl5g=)
at Aspose.Pdf.Forms.SignatureField…ctor(#=zKDi6weuPF0KFdCxX7iW74xYtfRHCMzE4ZQ== #=zob3qGz0=, Document #=z$00Vl5g=)
at Aspose.Pdf.Forms.Field.#=zw49qYhg=(#=zKDi6weuPF0KFdCxX7iW74xYtfRHCMzE4ZQ== #=zbnG$ZOc=, Document #=z$00Vl5g=)
at Aspose.Pdf.Forms.Form.#=zbe0uhng=.get_Current()

It looks as the constructor for the signature fields has a problem.
We are using Version 22.5.0.

Does

@Markus_Jenni

Would you please share your sample PDF document along with the sample code snippet with us? We will test the scenario in our environment and address it accordingly.

I removed some pages and blackened the confidential content. The signatures however I had to leave for obvious reasons.

var doc = new Document(@“C:……\Antrag-Sicherheitsüberprüfung-signed-Invalid-Kopie.pdf”);

var fields = doc.Form.Fields;

We are using Aspose.Pdf version 22.5

Thank you for testing the scenario on your environment.

Best regards
Markus

image002.png (1.32 KB)

Antrag-Sicherheitsüberprüfung-signed-Invalid-Kopie.pdf (833 KB)

@Markus_Jenni

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55943

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.