I have a PDF below with a couple of annotations. It is possible to flatten the annotations onto the PDF?
I have tried the below code segment, but it's not working well. I didn't find much information on Flatten(), please tell me if I'm using it incorrectly.
I have attached two documents:
Original_SAMPLE.pdf - the original PDF with annotations
FLATTENED_SAMPLE.pdf- what I hope to do.
string pdfPath = inputpath; Document doc = new Document(pdfPath); for (int i = 1; i < doc.Pages.Count && i < 5; i++) { Page page = doc.Pages[i]; List<Annotation> annotations = new List<Annotation>(); for (int j = 1; j <= page.Annotations.Count; j++) annotations.Add(page.Annotations[j]); foreach (Annotation annot in annotations) annot.Flatten(); } doc.Save(outputpath);v