SaveAnnotationsToXMPEx(String) Method
In This Topic
Saves the GdPicture/XMP annotation part of all pages of the document currently handled by this AnnotationManager object 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
Parameters
- FilePath
- The file path of the XML formatted file to create and save all GdPicture/XMP annotations from the handled 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.
Example
How to transfer GdPicture/XMP annotations from one PDF document to another.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.SaveAnnotationsToXMPEx("annots.xml") = GdPictureStatus.OK) Then
annotationManager.Close()
If (annotationManager.InitFromFile("dest.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.LoadAnnotationsFromXMP("annots.xml") = GdPictureStatus.OK) Then
If annotationManager.SaveDocumentToPDF("dest_updated.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPEx")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx")
End If
annotationManager.Close()
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK) &&
(annotationManager.SaveAnnotationsToXMPEx("annots.xml") == GdPictureStatus.OK))
{
annotationManager.Close();
if ((annotationManager.InitFromFile("dest.pdf") == GdPictureStatus.OK) &&
(annotationManager.LoadAnnotationsFromXMP("annots.xml") == GdPictureStatus.OK))
{
if (annotationManager.SaveDocumentToPDF("dest_updated.pdf") == GdPictureStatus.OK) MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPEx");
}
else MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx");
annotationManager.Close();
}
else MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx");
annotationManager.Dispose();
Example
How to transfer GdPicture/XMP annotations from one PDF document to another.
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("source.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.SaveAnnotationsToXMPEx("annots.xml") = GdPictureStatus.OK) Then
annotationManager.Close()
If (annotationManager.InitFromFile("dest.pdf") = GdPictureStatus.OK) AndAlso
(annotationManager.LoadAnnotationsFromXMP("annots.xml") = GdPictureStatus.OK) Then
If annotationManager.SaveDocumentToPDF("dest_updated.pdf") = GdPictureStatus.OK Then
MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPEx")
End If
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx")
End If
annotationManager.Close()
Else
MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx")
End If
annotationManager.Dispose()
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("source.pdf") == GdPictureStatus.OK) &&
(annotationManager.SaveAnnotationsToXMPEx("annots.xml") == GdPictureStatus.OK))
{
annotationManager.Close();
if ((annotationManager.InitFromFile("dest.pdf") == GdPictureStatus.OK) &&
(annotationManager.LoadAnnotationsFromXMP("annots.xml") == GdPictureStatus.OK))
{
if (annotationManager.SaveDocumentToPDF("dest_updated.pdf") == GdPictureStatus.OK) MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMPEx");
}
else MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx");
annotationManager.Close();
}
else MessageBox.Show("Error! Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMPEx");
annotationManager.Dispose();
See Also