Free Support Forum - aspose.com

Pdf file was damaged by "Flatten"

Hi

I tried to run the following code on the attached PDF.
SetLicense();
Document pdfDoc = new Document(@“C:\Users\tali\Desktop\ge309A2IN.pdf”);
Form pdfForm = new Form();
pdfForm.BindPdf(pdfDoc);
pdfForm.FlattenAllFields();
pdfDoc.Save(@“C:\Users\tali\Desktop\ge309A2OUT.pdf”);

The PDF file was damaged.
Please advise.
Thanks.

Hi Oren,


Thank you for contacting support. We have tested your source PDF with the latest version 17.5 of Aspose.Pdf for .NET API and as per our observation, the output PDF is not damaged. We have attached the output PDF to this reply.

Hi

Thank you for your quick answer.
Your output file is the same as mine. It is damaged. Please compare it to the original one. The original one looks very different.

Thanks

Hi Oren,


Thanks for the acknowledgement.

As per our understanding, the output file generated with Aspose.Pdf for .NET has some layers visible and it is because of FlattenField method. Do you meant to state the same issue or you have some different observations. Please share some further details.

For your reference, I have also attached the output PDF and image file showing resultant file contents. We are really sorry for this inconvenience.

Hi,

We need that the FlattenField method will not damage the file visibility, so the layers that were invisible should stay invisible. Is there a way to achieve that?

Thanks

@oren10280

Thanks for your inquiry and sorry for the delayed response.

We are testing the scenario and will get back to you shortly. Please be patient.


Best Regards,
Asad Ali

@oren10280

Thanks for your patience.

We have tested the scenario with following code snippet and observed that some PDF layers are visible after flattening the document, which were invisible before.

Document doc = new Document(dataDir + "ge309A2IN.pdf");
doc.Flatten();
doc.Save(dataDir + "738676_Flat_out.pdf"); 

Therefore, I have logged an issue as PDFNET-42982 in our issue tracking system. We will further investigate the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,
Asad Ali