GdPicture.NET.14
GdPicture14 Namespace / AnnotationManager Class / SaveAnnotationsToXMPEx Method / SaveAnnotationsToXMPEx(Stream) Method
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.
Example





In This Topic
SaveAnnotationsToXMPEx(Stream) 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 an instantiated Stream object according to what you have specified.

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

Syntax
'Declaration
 
Public Overloads Function SaveAnnotationsToXMPEx( _
   ByVal Stream As Stream _
) As GdPictureStatus
public GdPictureStatus SaveAnnotationsToXMPEx( 
   Stream Stream
)
public function SaveAnnotationsToXMPEx( 
    Stream: Stream
): GdPictureStatus; 
public function SaveAnnotationsToXMPEx( 
   Stream : Stream
) : GdPictureStatus;
public: GdPictureStatus SaveAnnotationsToXMPEx( 
   Stream* Stream
) 
public:
GdPictureStatus SaveAnnotationsToXMPEx( 
   Stream^ Stream
) 

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.

Remarks
The output stream should be open for writing and should be closed/disposed of by the user as well.

This method requires the Annotations component to run.

Example
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();
See Also