GdPicture.NET.14
GdPicture14 Namespace / GdViewer 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 SaveAnnotationsToXMP(String) method or the SaveAnnotationsToXMPEx(String) method. The loaded annotations are subsequently applied to the document currently displayed in the GdViewer control to the current 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
The method only handles GdPicture/XMP annotations as well.

Be aware that the loaded annotations will replace the current annotations presented in the document. For adding new annotations you can use the AddAnnotationFromXML method.

Example
How to transfer GdPicture/XMP annotations from the current page of the displayed document to the same page of another document.
'We assume that the GdViewer1 control has been properly integrated
'and your document has been properly displayed as well.
            
'Assuming you have already annotated the displayed document.
If GdViewer1.SaveAnnotationsToXMP("annots.xml") = GdPictureStatus.OK Then
    Dim pageNr As Integer = GdViewer1.CurrentPage
    GdViewer1.CloseDocument()
    If (GdViewer1.DisplayFromFile("test.pdf") = GdPictureStatus.OK) AndAlso
       (GdViewer1.LoadAnnotationsFromXMP("annots.xml") = GdPictureStatus.OK) Then
        GdViewer1.DisplayPage(pageNr)
        If GdViewer1.SaveDocumentToPDF("test_annotated.pdf") = GdPictureStatus.OK Then
            MessageBox.Show("Done!", "GdViewer.LoadAnnotationsFromXMP")
        Else
            MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.LoadAnnotationsFromXMP")
        End If
    Else
        MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.LoadAnnotationsFromXMP")
    End If
End If
//We assume that the GdViewer1 control has been properly integrated
//and your document has been properly displayed as well.
            
//Assuming you have already annotated the displayed document.
if (GdViewer1.SaveAnnotationsToXMP("annots.xml") == GdPictureStatus.OK)
{
    int pageNr = GdViewer1.CurrentPage;
    GdViewer1.CloseDocument();
    if ((GdViewer1.DisplayFromFile("test.pdf") == GdPictureStatus.OK) &&
        (GdViewer1.LoadAnnotationsFromXMP("annots.xml") == GdPictureStatus.OK))
    {
        GdViewer1.DisplayPage(pageNr);
        if (GdViewer1.SaveDocumentToPDF("test_annotated.pdf") == GdPictureStatus.OK)
            MessageBox.Show("Done!", "GdViewer.LoadAnnotationsFromXMP");
        else
            MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.LoadAnnotationsFromXMP");
    }
    else
    {
        MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.LoadAnnotationsFromXMP");
    }
}
See Also