Image on annotation not shown in viewer.

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Moderator: Alex

Post Reply
IntegraHarlan
Posts: 65
Joined: Fri Jan 24, 2020 3:37 am

Image on annotation not shown in viewer.

Post 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
Alex
Site Admin
Posts: 1942
Joined: Thu Jul 10, 2008 2:21 pm

Re: Image on annotation not shown in viewer.

Post 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
Alex
Site Admin
Posts: 1942
Joined: Thu Jul 10, 2008 2:21 pm

Re: Image on annotation not shown in viewer.

Post 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
Alex
Site Admin
Posts: 1942
Joined: Thu Jul 10, 2008 2:21 pm

Re: Image on annotation not shown in viewer.

Post 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
Post Reply