I’m experiencing issues with flattening annotations in a PDF document using Aspose.PDF. We are importing XFDF annotations and attempting to flatten them, but some annotations do not render correctly in the final output. Specifically, the following issues occur:
Underlines and Squiggly Text: After flattening, the underline and squiggly text annotations are missing.
Polygon and Cloud Shapes: The fill color inside the polygon and cloud shapes is not appearing. Only the outline is visible.
Cloud Shapes: Cloud shapes are turning into regular lines and lose their “bump” structure.
We tried the following approach to flatten annotations but encountered the issues mentioned above. Here’s the code we used:
PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();
AnnotationEditor.BindPdf(inputpath);
// Import annotation from XFDF
using (MemoryStream xfdfStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(xmlString)))
{
AnnotationEditor.ImportAnnotationsFromXfdf(xfdfStream);
}
// Flatten the annotations
AnnotationEditor.FlatteningAnnotations();
// Save the output PDF
AnnotationEditor.Save(outputpath);
I have attached the input file and the output file after flattening and also the XFDF string file
The Asposeoutput shows the issues described above when compared with expected output which is coming before flattening.
Please let me know if there’s anything I can adjust in the code or if there’s a known limitation with Aspose.PDF when flattening these specific annotations. I would appreciate your guidance on resolving this issue.
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-58963
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.
Is there any work around currently i can use to get the flatten PDF , as i have to do some other operations on the PDF downstream which are getting impacted with this ?
We tested using 24.12 version and the suggested code snippet from our previous reply and the output remained same. Fattened_out.pdf (23.0 KB)
The ticket information has been updated accordingly as well. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.