Page 1 of 1

Image on annotation not shown in viewer.

Posted: Sat Feb 20, 2021 12:25 am
by IntegraHarlan
Hi,
I have a pdf page that has a line annotation with an image on the annotation. The image appears to be added on the annotation when a comment was added to the annotation.
The Image appears to be a comment icon.
When I open the PDF document in Adobe I can see the image on the line annotation.
When I open the PDF document with the PDFEditorDemo, the image is not shown on the annotation.

Is there a way to display the image?
I will send the document to your support address and reference this post.

Thanks
Harlan

Re: Image on annotation not shown in viewer.

Posted: Sat Feb 20, 2021 9:24 am
by Alex
Hi Harlan,

Thank you for information and test PDF document. We reproduced the problem and need some time to analyze the situation. I will contact you shortly.

Best regards, Alexander

Re: Image on annotation not shown in viewer.

Posted: Wed Feb 24, 2021 12:52 pm
by Alex
Hi Harlan,

We tested your PDF document and have found that only Adobe displays icon image on the line annotation. Foxit and other PDF viewers do not do this. Also we have found that line annotation does not have any information, which defines icon image. These facts say that this is special feature of Adobe.

In next minor version (10.0.5.1) we will add the ability to draw decorations on annotation. I will notify you when new functionality will be available.

Best regards, Alexander

Re: Image on annotation not shown in viewer.

Posted: Sat Feb 27, 2021 10:18 am
by Alex
Hi Harlan,

In version 10.0.5.1 we have added overridable DrawCommentSourceDecorations method to the CommentVisualTool visual tool. The method allows to draw custom graphics on annotation that has comment.

Here is code of custom CommentVisualTool that draws yellow rectangle on annotaions, which have comment:

Code: Select all

public class MyCommentVisualTool: CommentVisualTool
{
    public MyCommentVisualTool(ImageViewerCommentController commentController, ICommentControlFactory commentControlFactory)
        : base(commentController, commentControlFactory)
    {
    }

    protected override void DrawCommentSourceDecorations(PaintEventArgs paintArgs, Comment comment, Rectangle commentSourceBoundingBox)
    {
        if (!string.IsNullOrEmpty(comment.Text))
        {
            SizeF size = new SizeF(10, 10);
            PointF location = new PointF(
                commentSourceBoundingBox.X + commentSourceBoundingBox.Width / 2 - size.Width / 2,
                commentSourceBoundingBox.Y + commentSourceBoundingBox.Height / 2 - size.Height / 2);
            paintArgs.Graphics.FillRectangle(Brushes.Yellow, new RectangleF(location, size));
        }
    }
}
For using MyCommentVisualTool class in PdfEditorDemo project please change line:

Code: Select all

_commentTool = new CommentVisualTool(commentController, new CommentControlFactory());
to the following line:

Code: Select all

_commentTool = new MyCommentVisualTool(commentController, new CommentControlFactory());
Best regards, Alexander