Flatten Annotation from PDF to XFDF
Contents
[
Hide
]
The flattening process means when an annotation is removed from a document, its visual representation is kept intact. A flattened annotation is still visible but is no longer editable by your users or by your app. This can be used, for example, to permanently apply annotations to your document or to make annotations visible to viewers that otherwise can’t show annotations. If not specified, an export will keep all annotations as they are.
When this option is selected, your annotations will be included in your exported PDF as PDF-standard annotations.
Check how the flatteningAnnotations method used in the next code snippet.
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void FlattenAnnotationFromPdf()
{
// The path to the documents directory
string dataDir = RunExamples.GetDataDir_AsposePdf();
// Create PdfAnnotationEditor
using (var annotationEditor = new Aspose.Pdf.Facades.PdfAnnotationEditor())
{
annotationEditor.BindPdf(dataDir + "input.pdf");
// Create FlattenSettings
var flattenSettings = new Aspose.Pdf.Forms.Form.FlattenSettings
{
ApplyRedactions = true,
CallEvents = false,
HideButtons = true,
UpdateAppearances = true
};
annotationEditor.FlatteningAnnotations(flattenSettings);
// Save document
annotationEditor.Save(dataDir + "FlattenAnnotation_out.pdf");
}
}