GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / SaveAnnotationsToXMP Method / SaveAnnotationsToXMP(String) Method
The file path of the XML formatted file to create and save all GdPicture/XMP annotations from the selected page.
Example





In This Topic
SaveAnnotationsToXMP(String) Method
In This Topic
Saves the GdPicture/XMP annotation part of the selected page of the document currently handled by this AnnotationManager object in XML format to a file according to a file path you have specified.

Be aware that this method only handles GdPicture/XMP annotations. Likewise, annotations are always treated relative to the selected page.

Syntax
'Declaration
 
Public Overloads Function SaveAnnotationsToXMP( _
   ByVal FilePath As String _
) As GdPictureStatus
public GdPictureStatus SaveAnnotationsToXMP( 
   string FilePath
)
public function SaveAnnotationsToXMP( 
    FilePath: String
): GdPictureStatus; 
public function SaveAnnotationsToXMP( 
   FilePath : String
) : GdPictureStatus;
public: GdPictureStatus SaveAnnotationsToXMP( 
   string* FilePath
) 
public:
GdPictureStatus SaveAnnotationsToXMP( 
   String^ FilePath
) 

Parameters

FilePath
The file path of the XML formatted file to create and save all GdPicture/XMP annotations from the selected page.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.

We strongly recommend always checking this status first.

Remarks
Be aware that this method only handles GdPicture/XMP annotations contained within the currently selected page.

This method requires the Annotations component to run.

Example
How to transfer GdPicture/XMP annotations from one jpg file to another.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("image1.jpg") = GdPictureStatus.OK) AndAlso
   (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) AndAlso
   (annotationManager.SaveAnnotationsToXMP("annots.xml") = GdPictureStatus.OK) Then
    annotationManager.Close()
    If (annotationManager.InitFromFile("image2.jpg") = GdPictureStatus.OK) AndAlso
       (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) AndAlso
       (annotationManager.LoadAnnotationsFromXMP("annots.xml") = GdPictureStatus.OK) Then
        If annotationManager.SaveDocumentToJPEG("image2.jpg", 75) = GdPictureStatus.OK Then MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMP")
    Else
        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP")
    End If
    annotationManager.Close()
Else
    MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("image1.jpg") == GdPictureStatus.OK) &&
    (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK) &&
    (annotationManager.SaveAnnotationsToXMP("annots.xml") == GdPictureStatus.OK))
{
    annotationManager.Close();
    if ((annotationManager.InitFromFile("image2.jpg") == GdPictureStatus.OK) &&
        (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK) &&
        (annotationManager.LoadAnnotationsFromXMP("annots.xml") == GdPictureStatus.OK))
    {
        if (annotationManager.SaveDocumentToJPEG("image2.jpg", 75) == GdPictureStatus.OK) MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMP");
    }
    else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP");
    annotationManager.Close();
}
else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP");
annotationManager.Dispose();
See Also