GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / LoadAnnotationsFromXMPBase64 Method
A Base64 encoded string of the annotations data to load.
Example





In This Topic
LoadAnnotationsFromXMPBase64 Method (AnnotationManager)
In This Topic
Loads the GdPicture/XMP annotations from a specified Base64 encoded string, that has been previously generated using the SaveAnnotationsToXMPBase64 method or the SaveAnnotationsToXMPBase64Ex 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 Function LoadAnnotationsFromXMPBase64( _
   ByVal Content As String _
) As GdPictureStatus
public GdPictureStatus LoadAnnotationsFromXMPBase64( 
   string Content
)
public function LoadAnnotationsFromXMPBase64( 
    Content: String
): GdPictureStatus; 
public function LoadAnnotationsFromXMPBase64( 
   Content : String
) : GdPictureStatus;
public: GdPictureStatus LoadAnnotationsFromXMPBase64( 
   string* Content
) 
public:
GdPictureStatus LoadAnnotationsFromXMPBase64( 
   String^ Content
) 

Parameters

Content
A Base64 encoded string of the annotations data 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 AddAnnotationFromXML method.

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