Flattening annotations doesn't work as intended

hi everyone,

I'm trying to flatten pdf files which contain annotations :

Capture1.jpg

for this I've tried to use SyncFusion's embedded function, which seems easy enough :


public void flattenPdfFileSyncFusion(string path)
{
//Load the existing PDF document
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(path);
//Get all the pages
foreach (PdfLoadedPage loadedPage in loadedDocument.Pages)
{
//Flatten all the annotations in the page
loadedPage.Annotations.Flatten = true;


}
//Save and close the PDF document instance
loadedDocument.Save(path);
loadedDocument.Close(true);
}


but the results are pretty strange, and the best outcome I could get (depending on source file) is this :

Capture2.jpg


sometimes the annotations completely disappear too (maybe it depends on the original file generated from PDFCreator or WonderShare).

is it a common issue ?

and most importantly, is there any workaround to this ?


thank you


1 Reply

GK Gowthamraj Kumar Syncfusion Team September 17, 2021 09:05 AM UTC

Hi PAIN, 

Thank you for contacting Syncfusion support.

We have tried to reproduce the reported issue with our test documents in our end, but it is flatten properly. We suspect that the issue may occurs with the specific input document. We have attached the sample with output document for your reference, please try the sample on your end and let us know the result. 

We request you to share the input document, modified sample, product version to reproduce the issue in our end. So that it will be helpful for us to analyze and assist you further on this.

Regards, 
Gowthamraj K 


Loader.
Up arrow icon