Android
ComPDFKit PDF SDK
Guides

Flatten Annotations

 

Annotation flattening refers to the operation that changes annotations into a static area that is part of the PDF document, just like the other text and images in the document. When flattening an annotation, the annotation is removed from the document, while its visual representation is kept intact. A flattened annotation is still visible but is no longer editable by your users or by your app.

 

Annotations in a PDF document can be flattened in the ComPDFKit by calling flattenAllPages and save function.

// Open document from file path
CPDFDocument document = new CPDFDocument(context);
document.open(pdfPath, passwod);
// flatten all pages from document
boolean result = document.flattenAllPages(CPDFPage.PDFFlattenOption.FLAT_NORMALDISPLAY);
// save document
if (result) {
 document.save();
}