SaveAnnotationsToXMPEx(Stream) Method
Saves the GdPicture/XMP annotation part of all pages of the document currently handled by this AnnotationManager object in XML format to an instantiated Stream object according to what you have specified.
Be aware that this method only handles GdPicture/XMP annotations.
'Declaration
Public Overloads Function SaveAnnotationsToXMPEx( _
ByVal As Stream _
) As GdPictureStatus
Parameters
- Stream
- A System.IO.Stream object where all GdPicture/XMP annotations from the selected page will be saved to.
This Stream object must be initialized before it can be sent into this method and it should remain open for subsequent use.
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 TIFF file to another using a stream.
Dim annotStream As System.IO.MemoryStream = New System.IO.MemoryStream()
Dim annotationManager As AnnotationManager = New AnnotationManager()
If (annotationManager.InitFromFile("source.tiff") = GdPictureStatus.OK) AndAlso
(annotationManager.SaveAnnotationsToXMP(annotStream) = GdPictureStatus.OK) Then
annotationManager.Close()
If (annotationManager.InitFromFile("dest.tiff") = GdPictureStatus.OK) AndAlso
(annotationManager.LoadAnnotationsFromXMP(annotStream) = GdPictureStatus.OK) Then
If annotationManager.SaveDocumentToTIFF("dest_updated.tiff", TiffCompression.TiffCompressionAUTO) = 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()
annotStream.Dispose()
System.IO.MemoryStream annotStream = new System.IO.MemoryStream();
AnnotationManager annotationManager = new AnnotationManager();
if ((annotationManager.InitFromFile("source.tiff") == GdPictureStatus.OK) &&
(annotationManager.SaveAnnotationsToXMPEx(annotStream) == GdPictureStatus.OK))
{
annotationManager.Close();
if ((annotationManager.InitFromFile("dest.tiff") == GdPictureStatus.OK) &&
(annotationManager.LoadAnnotationsFromXMP(annotStream) == GdPictureStatus.OK))
{
if (annotationManager.SaveDocumentToTIFF("dest_updated.tiff", TiffCompression.TiffCompressionAUTO) == 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();
annotStream.Dispose();