Accessing a field value and then flattening the field doesn't work in multiple ways

We are attempting to flatten the fields in a PDF document after we’ve inspected each of them, attempting to retrieve their values. However, there are 3 fields in the attached document that are causing problems.



All three of the fields contain the year - they are named “year_1”, “year_2”, and “year_4”. If we simply flatten the fields without inspecting them first, the flattening works as expected. However, if we first retrieve the value of any of those fields before flattening the fields, not only do we get the wrong value, but the resulting document presents an error when opened.



To reproduce the problem use the following code:



Dim Document as New Aspose.Pdf.Document(SourcePath)

Dim Form as New Aspose.Pdf.Facades.Form(Document)



Dim year_1Value = Form.GetField(“year_1”)

Form.FlattenAllFields()

Document.Save(DestPath)



If you then open the document in Acrobat and scroll to the second page, you’ll see the following error:



An error exists on this page. Acrobat may not display the page correctly. Please contact the person who created the PDF document to correct the problem.





You’ll also notice that the field for the year near the top of the second page (“year_1”) is blank. If you step through the code in the debugger, you’ll also see that the value retrieved from the call to GetField is an empty string, and not the “2017” that’s actually stored there. Both fields “year_2” and “year_4” will be flattened and have their original values (“2017”), but if you alter the code above so that it looks up those fields’ values, they will show the same behavior as “year_1” does.



Note: there are a couple other fields in that document that are meant to contain years, but they aren’t filled in, and I have not tested if the same happens with them once they are filled.



Can this behavior be corrected?



Thanks,

Michael Whalen

Hi Michael,


Thanks for contacting support.

I have tested the whole scenario and observed the same issue which you have mentioned above. However, for the purpose of investigation, I have logged this issue as PDFNET-42585 in our issue tracking system. We will further look into the reasons which are causing the issue and keep you informed on the status of its resolution. Please be patient and spare us a little time.

We are sorry for the inconvenience.


Best Regards,

Is there any update on this issue, by any chance? It has been quite a while since we reported it, and the client who it’s affecting is asking for a fix or at least an update.

Thanks,
Michael Whalen

@mwhalen

Thanks for contacting support.

I am afraid that earlier logged issue is not yet resolved due to large number of pending issues in the queue. We are sure that product team will plan to provide a fix against your issue as per their development schedule. We have recorded your recent concerns and intimated relevant team about it. As soon as we receive some significant updates regarding resolution of your issue, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.

Checking again - has there been any updated status on this, by any chance? We’d still like this issue resolved, if at all possible.

Thank you,
Michael Whalen

@mwhalen

Thanks for your inquiry.

I regret to share that your issue is not yet resolved due to high number of pending issues in the queue. Please note that your issue was logged under free support model and its priority was low. If issue is a blocker, you may definitely escalate the issue priority by using paid/priority support option where issues are resolved on urgent basis. As soon as we have some definite updates regarding its resolution, we will surely inform you. Please spare us little time.

We are sorry for the inconvenience.

I’ve consulted with my team and our clients and would like to escalate this issue to priority support, please.

Thank you,
Michael Whalen

@mwhalen

Thanks for contacting support.

We request you to please create a post over Helpdesk with the reference of issue ID PDFNET-42585. Your issue will be escalated accordingly. You may login to heldesk using same email address used to subscribe the paid support. In case of any other assistance, please feel free to let us know.

The issues you have found earlier (filed as PDFNET-42585) have been fixed in Aspose.PDF for .NET 19.12.