Load annotations on page changed event

Discussions about annotation support.
Post Reply
lordnedox
Posts: 16
Joined: Sun Oct 10, 2010 5:13 am

Load annotations on page changed event

Post by lordnedox » Wed Jul 13, 2011 7:02 am

What I basically want to do is allow the user to annotate any page, and save everything to a file/database. The saving process works just fine.

Now I have to restore the annotations, this should be done each time the user changes the document page. So I added a handler to "PageChanged" event on GdViewer, to restore the annotations.

Given the name, I suppose the page is fully loaded when the event fires, but it appears that loading the annotation using LoadAnnotationsFromXMP cannot be done inside this event.

You can try with the included sample for the annotation:

Code: Select all

        private void Form1_Load( System.Object sender, System.EventArgs e ) 
        {
            GdViewer1.SetLicenseNumber("xxxxxxxxxxxxxxxxxxxxxxxx");
            BookmarksTree1.GdViewer = GdViewer1;
            GdViewer1.PageChanged += new GdViewer.PageChangedEventHandler(GdViewer1_PageChanged);
        }

        void GdViewer1_PageChanged()
        {
            GdViewer1.LoadAnnotationsFromXMP( path to the xmp file );
        } 
Then try to change the document page, annotations will not be loaded on each page, as expected.

No problem if LoadAnnotationsFromXMP is called after the document has been loaded (for example using a button).

Any workaround? I think it's quite important that we're able to restore annotation programmatically and for each page, otherwise we're limited to the first page only...

Regards

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Load annotations on page changed event

Post by Loïc » Wed Jul 13, 2011 11:37 am

Hi,

You are right. You will be able to load the annots in this event within the next release that we should publish within few hours..

Hope this helps !

Loïc

lordnedox
Posts: 16
Joined: Sun Oct 10, 2010 5:13 am

Re: Load annotations on page changed event

Post by lordnedox » Wed Jul 13, 2011 1:59 pm

Thanks for the fast resolution.

Working a bit on these annotations, I would like to suggest a few improvements you may consider for the future:

- Load and Save in memory streams, not just on files (important for programs saving the data on a database)
- After using tools such hand writing, as soon as the user finish to draw, update the annotation to what will actually be saved in the XMP file. Right now the user thinks to save a nice curved line, and when he'll load the annotation again he will find a mess, totally different what he drew (maybe as an optional parameter?)
- If possible, load and save annotations for all the pages, not just the current page (now can be done anyway listening to page changed event, and saving for each annotation added)

- Also i found a bug but i'm still investigating, will update in the future...

Regards

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Load annotations on page changed event

Post by Loïc » Thu Jul 14, 2011 9:59 am

Hi,

You can download the 8.0.4 that fix the problem. Let me know if you encounter any other bug.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests