LoadAnnotationsFromXMP(String) Method
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.
'Declaration
Public Overloads Function LoadAnnotationsFromXMP( _
ByVal As String _
) As GdPictureStatus
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.
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();