GdPicture.NET.14.API
GdPicture14 Namespace / AnnotationManager Class / LoadAnnotationsFromXMP Method / LoadAnnotationsFromXMP(String) Method
The file path of the properly formatted XML file to load.
Example





In This Topic
LoadAnnotationsFromXMP(String) Method
In This Topic
Loads the GdPicture/XMP annotations from a specified XML formatted file, that has been previously generated using the AnnotationManager.SaveAnnotationsToXMP method or the AnnotationManager.SaveAnnotationsToXMPEx method. The loaded annotations are subsequently applied to the document currently handled by this AnnotationManager object to the selected page or all pages, respectively. This means that the loaded annotations will replace the current annotations presented in the document.

Be aware that this method only handles GdPicture/XMP annotations.

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

Parameters

FilePath
The file path of the properly formatted XML file to load.

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 the loaded annotations will replace the current annotations presented in the document. For adding new annotations you can use the AnnotationManager.AddAnnotationFromXML method.

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.LoadAnnotationsFromXMP")
    Else
        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.LoadAnnotationsFromXMP")
    End If
    annotationManager.Close()
Else
    MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.LoadAnnotationsFromXMP")
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.LoadAnnotationsFromXMP");
    }
    else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.LoadAnnotationsFromXMP");
    annotationManager.Close();
}
else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.LoadAnnotationsFromXMP");
annotationManager.Dispose();
See Also