(WPF) Large image annotations causing lag

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

Moderator: Alex

Post Reply
missionRoom
Posts: 18
Joined: Wed Jan 22, 2020 4:38 pm

(WPF) Large image annotations causing lag

Post by missionRoom »

Hi,

When I add a large image annotation (approx 1000px x 1250px) to the WpfAnnotationViewer, then save and reload the PDF, I get lag when adding a new annotations. It also seems to happen, when I add a lot of small annotations.
The lag is most obvious when adding a freehand pen annotation, there is a large gap between the first and second point (so it forms a straight line), before it starts behaving normally.
Below is my loading code (not sure if that's the issue, since the lag doesn't happen until the PDF has been saved and re-loaded)?

The image shows the freehand annotations (in red), they all have large straight sections at the beginning, but should have followed the drawn path (that wasn't straight).

https://ibb.co/Cmjk5C7

Code: Select all

//Loading PDF file
this.annotationViewer.Dispatcher.Invoke(new Action(() =>
{
    this.annotationViewer.Image = image;

    //Set the initial zoom
    UpdateZoom(Vintasoft.Imaging.UI.ImageSizeMode.BestFit);
    (ViewManager.Instance.ControlsWindow.DataContext as ControlsWindowVM).MinZoomValue = (float)this.annotationViewer.Zoom;
}));
Thanks for any help
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: (WPF) Large image annotations causing lag

Post by Alex »

Hello,

For understanding the problem we need to reproduce the problem on our side. Please send us (to support@vintasoft.com) a small WPF project, which allows to reproduce the problem.

Best regards, Alexander
missionRoom
Posts: 18
Joined: Wed Jan 22, 2020 4:38 pm

Re: (WPF) Large image annotations causing lag

Post by missionRoom »

Hi,

Thanks for replying.

I've created a simple example, and haven't entirely been able to replicate the issue. But it has helped me work out what's causing the issue, it's the UndoManager/UndoMonitor. I initialise them as below when the image has loaded, if I omit this, then the issue completely goes away.

Is this the correct way to initialise the UndoManager/UndoMonitor? Are there any issues with this that you know of, or anything that could be causing this with relation to the UndoManager/UndoMonitor?

Code: Select all

this.annotationViewer.Dispatcher.Invoke(new Action(() =>
{
    this.annotationViewer.Image = image;

    //Set the initial zoom
    UpdateZoom(Vintasoft.Imaging.UI.ImageSizeMode.BestFit);
    (ViewManager.Instance.ControlsWindow.DataContext as ControlsWindowVM).MinZoomValue = (float)this.annotationViewer.Zoom;
}));

this._undoManager = new UndoManager();
this._undoMonitor = new WpfAnnotationViewerUndoMonitor(this._undoManager, this.annotationViewer);
Alex
Site Admin
Posts: 2319
Joined: Thu Jul 10, 2008 2:21 pm

Re: (WPF) Large image annotations causing lag

Post by Alex »

Thank you for information.

You have delay because an undo manager serializes image in its cache. We improved performance of this process in VintaSoft Imaging .NET SDK 12.2.11.1. What version of VintaSoft Imaging .NET SDK do you use?

Best regards, Alexander
missionRoom
Posts: 18
Joined: Wed Jan 22, 2020 4:38 pm

Re: (WPF) Large image annotations causing lag

Post by missionRoom »

I'm using V10.1.16.1, so it sounds like an upgrade may fix our problem.
Thanks for the help
Post Reply