Annotations save/load problem

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

Annotations save/load problem

Post by lordnedox » Tue Jul 19, 2011 4:39 am

Hi,
i apologize to bother you again but there's something wrong with the new annotation function.
I refer to "Free hand highlighter" and "Free hand draw" tools, the others look fine.

As I understand when saving (to xmp) the highlighted/drawn area you must convert it to a vector based line. That could be fine, but I would like to show to the user exactly what he's going to save (avoiding bad surprises when he re-opens the file).

So i use this piece of code (tried on GdPicture Annotation sample with the same results):

Code: Select all

//Load the file and register the listener
GdViewer1.DisplayFromFile(@"path to PDF file");
GdViewer1.AnnotationAddedByUser += new GdViewer.AnnotationAddedByUserEventHandler(GdViewer1_AnnotationAddedByUser);

Code: Select all

//On annotation added, store it to file and reload to show the effective result
void GdViewer1_AnnotationAddedByUser(int AnnotationIdx)
        {
            string path = @"c:\Temp\xxxx.xmp";
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            if (GdViewer1.SaveAnnotationsToXMP(path) == GdPictureStatus.OK)
            {
                GdViewer1.LoadAnnotationsFromXMP(path);
                GdViewer1.Redraw();
            }
            else
            {
                MessageBox.Show("ERR");
            }
        }
The result for the mentioned tools is that the line is on a really different position than the original. The line is there, but it's about 5/10 centimeters below or on the right.

Using manual Save/Load file to XMP (using the menus in the sample) the result is similar but not same, the accuracy is better even still not perfect.

So the questions are:
- How can i achieve my task? Is there a workaround or another way to store the annotation in a different file format? I quite don't care the XMP format, as I would never export it.
- What makes it different to store and load on the same method, rather than using the menus?
- Can you confirm that "SaveAnnotationsToXMP" cannot overwrite an existing file? (I suppose so, as i get an error)

Thanks
Regards

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

Re: Annotations save/load problem

Post by Loïc » Tue Jul 19, 2011 11:35 am

Hi,
i apologize to bother you again but there's something wrong with the new annotation function.
No problem, you are welcome to post any request or bug report here ;)

I just fixed the bug you encountered, so your snippet will work for the next medium release that we will publish this week.

For the SaveAnnotationsToXMP, I can confirm your remark. If the file already exists, it will not be overwritten.

let me know if you need other information.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest