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

SaveAnnotationsToXMP(Stream) Method

In This Topic
Saves the GdPicture/XMP annotation part of the selected page 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. Likewise, annotations are always treated relative to the selected page.

Syntax
'Declaration

 

Public Overloads Function SaveAnnotationsToXMP( _

   ByVal Stream As Stream _

) As GdPictureStatus
public GdPictureStatus SaveAnnotationsToXMP( 

   Stream Stream

)
public function SaveAnnotationsToXMP( 

    Stream: Stream

): GdPictureStatus; 
public function SaveAnnotationsToXMP( 

   Stream : Stream

) : GdPictureStatus;
public: GdPictureStatus SaveAnnotationsToXMP( 

   Stream* Stream

) 
public:

GdPictureStatus SaveAnnotationsToXMP( 

   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.

Be aware that this method only handles GdPicture/XMP annotations contained within the currently selected page.

This method requires the Annotations component to run.

Example
How to transfer GdPicture/XMP annotations from one jpg file to another.
Dim annotStream As System.IO.MemoryStream = New System.IO.MemoryStream()

Dim annotationManager As AnnotationManager = New AnnotationManager()

If (annotationManager.InitFromFile("image1.jpg") = GdPictureStatus.OK) AndAlso

   (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) AndAlso

   (annotationManager.SaveAnnotationsToXMP(annotStream) = GdPictureStatus.OK) Then

    annotationManager.Close()

    If (annotationManager.InitFromFile("image2.jpg") = GdPictureStatus.OK) AndAlso

       (annotationManager.PageCount > 0) AndAlso (annotationManager.SelectPage(1) = GdPictureStatus.OK) AndAlso

       (annotationManager.LoadAnnotationsFromXMP(annotStream) = GdPictureStatus.OK) Then

        If annotationManager.SaveDocumentToJPEG("image2.jpg", 75) = GdPictureStatus.OK Then MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMP")

    Else

        MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP")

    End If

    annotationManager.Close()

Else

    MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP")

End If

annotationManager.Dispose()

annotStream.Dispose()
System.IO.MemoryStream annotStream = new System.IO.MemoryStream();

AnnotationManager annotationManager = new AnnotationManager();

if ((annotationManager.InitFromFile("image1.jpg") == GdPictureStatus.OK) &&

    (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK) &&

    (annotationManager.SaveAnnotationsToXMP(annotStream) == GdPictureStatus.OK))

{

    annotationManager.Close();

    if ((annotationManager.InitFromFile("image2.jpg") == GdPictureStatus.OK) &&

        (annotationManager.PageCount > 0) && (annotationManager.SelectPage(1) == GdPictureStatus.OK) &&

        (annotationManager.LoadAnnotationsFromXMP(annotStream) == GdPictureStatus.OK))

    {

        if (annotationManager.SaveDocumentToJPEG("image2.jpg", 75) == GdPictureStatus.OK) MessageBox.Show("Done!", "AnnotationManager.SaveAnnotationsToXMP");

    }

    else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP");

    annotationManager.Close();

}

else MessageBox.Show("Error!   Status: " + annotationManager.GetStat().ToString(), "AnnotationManager.SaveAnnotationsToXMP");

annotationManager.Dispose();

annotStream.Dispose();
See Also