ImageGear for .NET
SavePage(ImGearARTPage,Stream,Int32,ImGearSavingModes,ImGearARTSaveType) Method
Example 




ART page with marks to save.
Stream to which to save annotation marks. The SavePage method works from the current stream position, so if you are intending to re-write the stream, you need to reset the stream position to the beginning.
Page number to save. First page is 1.
Saving mode.
Saving type.
Saves ART marks to a stream.
Syntax
'Declaration
 
Public Overloads Shared Sub SavePage( _
   ByVal artPage As ImGearARTPage, _
   ByVal stream As Stream, _
   ByVal pageNumber As Integer, _
   ByVal saveMode As ImGearSavingModes, _
   ByVal type As ImGearARTSaveType _
) 
'Usage
 
Dim artPage As ImGearARTPage
Dim stream As Stream
Dim pageNumber As Integer
Dim saveMode As ImGearSavingModes
Dim type As ImGearARTSaveType
 
ImGearART.SavePage(artPage, stream, pageNumber, saveMode, type)
public static void SavePage( 
   ImGearARTPage artPage,
   Stream stream,
   int pageNumber,
   ImGearSavingModes saveMode,
   ImGearARTSaveType type
)
public: static void SavePage( 
   ImGearARTPage* artPage,
   Stream* stream,
   int pageNumber,
   ImGearSavingModes saveMode,
   ImGearARTSaveType type
) 
public:
static void SavePage( 
   ImGearARTPage^ artPage,
   Stream^ stream,
   int pageNumber,
   ImGearSavingModes saveMode,
   ImGearARTSaveType type
) 

Parameters

artPage
ART page with marks to save.
stream
Stream to which to save annotation marks. The SavePage method works from the current stream position, so if you are intending to re-write the stream, you need to reset the stream position to the beginning.
pageNumber
Page number to save. First page is 1.
saveMode
Saving mode.
type
Saving type.
Remarks
This method saves annotation marks to XML stream.

This method can also be used to export ART 2.0 marks to the binary ART format.

Saving a multipage ART XML file with ImageGear.Formats.ImGearSavingModes.APPEND for the 4th parameter is a special case that requires seeking to the start of the stream before the SavePage call. Otherwise an attempt to save several ART pages to one XML file could result in an improperly formatted file from which only the annotations for the 1st page will be loaded, being saved. See the Sample Code below.

Example
private static void SaveMultipageArt(ImGearARTPage[] igARTPages, string XmlFilePath)
{
    using (FileStream fileContent = new FileStream(XmlFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
    {
        for (int i = 0; i < igARTPages.Length; i++)
        {
            if (igARTPages[i] != null)
            {
                //Must seek to the start of the stream before saving each ImGearARTPage
                // to a multipage XML ART file using ImGearSavingModes.APPEND
                fileContent.Position = 0;
                ImGearART.SavePage(igARTPages[i], fileContent, i, ImGearSavingModes.APPEND, ImGearARTSaveType.XML);
            }
        }
    }
}
Sub SaveMultipageArt(ByVal igARTPages() As ImGearARTPage, ByVal XmlFilePath As String)
    Dim fileContent As FileStream
    fileContent = Nothing
    Try
        fileContent = New FileStream(XmlFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)
        For i As Integer = 0 To igARTPages.Length - 1
            If (Not (igARTPages(i) Is Nothing)) Then
                'Must seek to the start of the stream before saving each ImGearARTPage
                ' to a multipage XML ART file using ImGearSavingModes.APPEND
                fileContent.Position = 0
                ImGearART.SavePage(igARTPages(i), fileContent, i, ImGearSavingModes.APPEND, ImGearARTSaveType.XML)
            End If
        Next
    Finally
        If Not fileContent Is Nothing Then
            fileContent.Close()
        End If
    End Try
End Sub
See Also

Reference

ImGearART Class
ImGearART Members
Overload List
ImGearARTPage Class
ImGearARTSaveType Enumeration

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback