Field values lost afte flatten pdf

Aspose.Pdf v. 10.1.0.0


Field values sometimes “disappear” after a pdf is flattened.
Don’t know if the values are lost (doubt it), or some sort of sizing/layering issue (most likely), but the end result is the same - nothing on the page where the field were.

Code used:
using (var pdfForm = new Aspose.Pdf.Facades.Form(source))
{
pdfForm.FlattenAllFields();
pdfForm.Save(destination);
}

1 Like

Hi Ivan,


Thanks for contacting support.

Can you please share your source/input PDF files which you are using so that we can test the scenario in our environment. We are sorry for this inconvenience.
Hi Nayyer,

Please find "before" and "after" files are attached. Look at the cover/first page.

My system works with pdf files coming from different sources (and versions).
Sometimes the aspose flattened results "loses" fields sometimes it doesn't. I'm guessing is a rendering issue, rather than really losing the values, but when it happens, the end result for me is the same.

Thanks.

Hi Ivan,


Thanks for sharing the resource file.

I have tested the scenario using Aspose.Pdf for .NET 11.1.0 and I am unable to notice any issue. For your reference, I have also attached the output generated over my end.

[C#]

using (var pdfForm = new Aspose.Pdf.Facades.Form(“c:/pdftest/before-flatten.pdf”))<o:p></o:p>

{

pdfForm.FlattenAllFields();

pdfForm.Save("c:/pdftest/Flattened_Result.pdf");

}

I downloaded the latest release (11.2).
The couple of cases I used for testing the failure now pass. That’s good news. Thanks.

On the other hand - with the previous version it didn’t fail all the time either - sometimes it would, sometimes, it won’t.
Do you know if the issue was specifically addressed in some release after 10.x or appears to be resolved as a byproduct of other work?

Hi Ivan,


Thanks for sharing the feedback.

Currently I may not be able to share the specific API release in which a particular problem related to form field flatten has been fixed, but it appears that fixes in recent release versions have resolved this problem. We encourage you to continue using latest release and in the event of any further query, please feel free to contact.

Hi,

I am having this same issue with the current release. I have the issue with a 2 page document where values are removed after Aspose.Pdf.Document.Flatten() or Aspose.Pdf.Facades.Form.FlattenAllFields() is called. When using Aspose.PDF v22.1.0 had the issue, upgraded to v22.11.0 and still have the issue. same document.

Here is my code:

        using(var doc1 = new Aspose.Pdf.Document("...document path.pdf"))
        {
            doc1.Flatten();
            doc1.Save("...flattened document path.pdf");
        }

OR

        using (var pdfForm = new Aspose.Pdf.Facades.Form("...document path.pdf"))
        {
            pdfForm.FlattenAllFields();
            pdfForm.Save("...flattened document path.pdf");
        }

OR, rendering the same pdf page as a image, the values are gone in the image.

        var renderer = new PngDevice(new Resolution(resolution));

            // Convert a particular page and save the image to stream
            renderer.Process(page, ims);

@k3j2h1433

Can you please share your sample PDF as well? We will test the scenario in our environment and address it accordingly.

The file has been attached here

Document Form Fields disappear when Flattened.pdf (4.9 MB)

@k3j2h1433

We have logged another ticket as PDFNET-53190 in our issue tracking system for your case. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Any update here? This is a huge issue for us. We have another instance where Aspose.Pdf.Document.Flatten() removes all the form fields without adding the values.

@k3j2h1433

The logged ticket has recently been registered in our issue tracking system and it will be investigated and resolved on a first come first serve basis. Your concerns have been recorded and we will surely notify you once there are some updates regarding its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

How can I expedite this?

@k3j2h1433

You can expedite the issue using our paid support channel if this issue is a showstopper for you. In case you already have paid support subscription, you can login there and create a topic with reference to the ticket ID. The issue will be escalated accordingly.

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