How Do I Create An Image Annotation?

Q: How Do I Create An Image Annotation?

To programmatically create an image annotation from a file you first need to create an attachment in the document using a buffer and the content type. That will give you an ID for the attachment. After that you can construct an Image annotation as usual and set the ImageAttachmentId and ContentType properties.

var buffer = await FileIO.ReadBufferAsync(file);

// Create an annotation attachment for the image in the document and get it's ID.
var attachmentId = await PDFView.Controller.GetPdfDocument().CreateAttachmentAsync(buffer, file.ContentType);

// Next, define the bounding box of the annotation on the page.
var boundingBox = new Rect(100, 100, 100, 100);

// Create the annotation and set the image attachment id and the content type.
var annotation = new Image
    BoundingBox = boundingBox,
    Description = "Logo",
    ImageAttachmentId = attachmentId,
    ContentType = file.ContentType,
    PageIndex = 0

// Add the annotation to the document.
annotation = await PDFView.Document.CreateAnnotationAsync(annotation) as Image;

See also the example code in the Catalog.