Flattening Annotations

When flattening an annotation, the annotation is removed from a document, but 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 (like Safari on iOS). If not specified, an export will keep all annotations as they are.

To flatten annotations when exporting, there are three methods on the Document object that you can use:

  // To save with flattened annotations to a file.
  await pdfView.Document.ExportFlattenedAsync(storageFile);

  // Alternative method to save with flattened annotations to a file.
  var exportOptions = new DocumentExportOptions{ Flattened = true };
  await pdfView.Document.ExportAsync(file, exportOptions);

  // To save with flattened annotations to a `DataWriter`.
  await pdfView.Document.ExportFlattenedToDataWriterAsync(dataWriter);

Note that if you set Flattened = true in DocumentExportOptions, the Incremental property is ignored because flattening requires a full rewrite of the PDF.