The Atalasoft WPF Annotation Viewer (AtalaAnnotationViewer class) attempts to extract annotations embedded in PDFs by default.
If you wish to disable this feature entirely you can set
atalaAnnotationViewer1.AutoImportXmp = false;
However, you may want to import annotations embedded in PDF but ignore unknown annotation types. The default behavior is that unknown annotation types will be rendered as WpfTextAnnotation with the text "Unknown Annotation" which can be very annoying.
In theory, one should be able to disable the import of unknown types simply by enumerating the AtalaAnnotationViewer.Importers until you find the PdfAnnotationDataImporter and set its SkipUnknownAnnotationTypes property to true
However, this setting has no effect...
The root cause is due to a slight design oversight of how we need to use the importers in the WPF viewer
The fix is to derive a custom PdfAnnotationDataImporter that implements the missing pieces and replace the current importer
First, add this custom PdfAnnotationDataImporter class to your project
public class CustomPdfAnnotationDataImporter:PdfAnnotationDataImporter
public override AnnotationDataImporter FromStream(Stream stm)
var importer = base.FromStream(stm);
if (importer is PdfAnnotationDataImporter pdfAnnotationDataImporter)
pdfAnnotationDataImporter.SkipUnknownAnnotationTypes = SkipUnknownAnnotationTypes;
pdfAnnotationDataImporter.FailsafeAnnotationFactory = FailsafeAnnotationFactory;
Second, instantiate a new CustomPdfAnnotationDataImporter, clear the Importers collection and add this new importer
In this example. your AtalaAnnotationViewer is named atalaAnnotationViewer1
var importer = new CustomPdfAnnotationDataImporter
SkipUnknownAnnotationTypes = true