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