GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / SaveAnnotationsToXMPEx Method / SaveAnnotationsToXMPEx(String) Method
The file path of the XML formatted file to create and save all GdPicture/XMP annotations from the displayed document.
Example





In This Topic
SaveAnnotationsToXMPEx(String) Method
In This Topic
Saves the GdPicture/XMP annotation part of all pages of the document displayed in the GdViewer control in XML format to a file according to a file path you have specified.

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

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

Parameters

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

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 handles all GdPicture/XMP annotations contained within the currently displayed document.

Example
How to transfer GdPicture/XMP annotations from one document to another.
'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.SaveAnnotationsToXMPEx("annots.xml") = GdPictureStatus.OK Then
    GdViewer1.CloseDocument()
    If (GdViewer1.DisplayFromFile("test.pdf") = GdPictureStatus.OK) AndAlso
       (GdViewer1.LoadAnnotationsFromXMP("annots.xml") = GdPictureStatus.OK) Then
        GdViewer1.Redraw()
        If GdViewer1.SaveDocumentToPDF("test_annotated.pdf") = GdPictureStatus.OK Then
            MessageBox.Show("Done!", "GdViewer.SaveAnnotationsToXMPEx")
        Else
            MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.SaveAnnotationsToXMPEx")
        End If
    Else
        MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.SaveAnnotationsToXMPEx")
    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.SaveAnnotationsToXMPEx("annots.xml") == GdPictureStatus.OK)
{
    GdViewer1.CloseDocument();
    if ((GdViewer1.DisplayFromFile("test.pdf") == GdPictureStatus.OK) &&
        (GdViewer1.LoadAnnotationsFromXMP("annots.xml") == GdPictureStatus.OK))
    {
        GdViewer1.Redraw();
        if (GdViewer1.SaveDocumentToPDF("test_annotated.pdf") == GdPictureStatus.OK)
            MessageBox.Show("Done!", "GdViewer.SaveAnnotationsToXMPEx");
        else
            MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.SaveAnnotationsToXMPEx");
    }
    else
    {
        MessageBox.Show("Error! : " + GdViewer1.GetStat().ToString(), "GdViewer.SaveAnnotationsToXMPEx");
    }
}
See Also