Visual Basic
C#
Managed Extensions for C++
C++/CLI
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.
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.
C# | Copy Code |
---|---|
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); } } } } |
Visual Basic | Copy Code |
---|---|
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 |