ImageGear22.Art Assembly > ImageGear.ART Namespace > ImGearART Class > SavePage Method : SavePage(ImGearARTPage,Stream,Int32,ImGearSavingModes,ImGearARTSaveType) Method |
'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 )
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.
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