HOWTO: Handling Unsupported Pdf Annotation Types
When dealing with PDF files which contain native Pdf annotation types unsupported by DotImage, you have a few options. You could create a custom renderer or translate the annotations to supported types or choose to ignore the unsupported types. In this article we will discuss how to convert Pdf link annotations to DotImage Hotspot annotations, in a Winforms application. We provide a renderer for Pdf link annotations for our web viewers, but not our winforms viewers
The idea is to use a PdfAnnotationImporter to import all annotations from the original file into an AnnotationDataCollection. Then iterate through the collection, if the data type is supported, just add it to the viewer's collection of annotations. If the annotation data type is a PdfLinkData object, create a HotSpotAnnotation setting the size and location property to those from the PdfLinkData object. Set the tooltip property of the HotSpotAnnotation to the Uri stored in the PdfLinkData object. Then just add the new HotSpotAnnotation to the viewer. You will to be handling the viewer's HotSpotClicked event. In the handler for this event, you will use launch a browser(if it's that type of link), pointing at the tooltip property we set earlier.
The beauty of this approach is that you can export any additional annotations over the original file(assuming you do not need to persist changes to the actual images). When exporting, exclude these temporary HotSpotAnnotations(as the original links will be in the file) and export only any other newly created annotations.
A sample application is attached.