Example





In This Topic
GdPicture14 Namespace / AnnotationManager Class / SaveAnnotationsToXMPBase64Ex Method

SaveAnnotationsToXMPBase64Ex Method (AnnotationManager)

In This Topic
Saves the GdPicture/XMP annotation part of all pages of the document currently handled by this AnnotationManager object to a Base64 encoded string.

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

Syntax
'Declaration
 
Public Function SaveAnnotationsToXMPBase64Ex() As String
public string SaveAnnotationsToXMPBase64Ex()
public function SaveAnnotationsToXMPBase64Ex(): String; 
public function SaveAnnotationsToXMPBase64Ex() : String;
public: string* SaveAnnotationsToXMPBase64Ex(); 
public:
String^ SaveAnnotationsToXMPBase64Ex(); 

Return Value

A Base64 encoded string containing the annotations data of all pages in the handled document.
Remarks

This method requires the Annotations component to run.

Example
How to transfer GdPicture/XMP annotations from one PDF document to another using a Base64 encoded string.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK Then
    Dim annotBase As String = annotationManager.SaveAnnotationsToXMPBase64Ex()
    If annotationManager.GetStat() = GdPictureStatus.OK Then
        annotationManager.Close()
        If (annotationManager.InitFromFile("dest.pdf") = GdPictureStatus.OK) AndAlso
           (annotationManager.LoadAnnotationsFromXMPBase64(annotBase) = GdPictureStatus.OK) Then
            If annotationManager.SaveDocumentToPDF("dest_updated.pdf") = GdPictureStatus.OK Then
                MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPBase64Ex")
            End If
            annotationManager.Close()
        Else
            MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex")
        End If
    Else
        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex")
    End If
Else
    MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if (annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK)
{
    string annotBase = annotationManager.SaveAnnotationsToXMPBase64Ex();
    if (annotationManager.GetStat() == GdPictureStatus.OK)
    {
        annotationManager.Close();
        if ((annotationManager.InitFromFile("dest.pdf") == GdPictureStatus.OK) &&
            (annotationManager.LoadAnnotationsFromXMPBase64(annotBase) == GdPictureStatus.OK))
        {
            if (annotationManager.SaveDocumentToPDF("dest_updated.pdf") == GdPictureStatus.OK)
                MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPBase64Ex");
            annotationManager.Close();
        }
        else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex");
    }
    else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex");
}
else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPBase64Ex");
annotationManager.Dispose();
See Also