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");
}
}
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