Share via


Ink.Save Method (PersistenceFormat, CompressionMode)

Converts the Ink object to the specified format, saves it by using the specified compression format, and returns the binary data in a Byte array.

Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)

Syntax

'Declaration
Public Function Save ( _
    p As PersistenceFormat, _
    c As CompressionMode _
) As Byte()
'Usage
Dim instance As Ink
Dim p As PersistenceFormat
Dim c As CompressionMode
Dim returnValue As Byte()

returnValue = instance.Save(p, c)
public byte[] Save (
    PersistenceFormat p,
    CompressionMode c
)
public:
array<unsigned char>^ Save (
    PersistenceFormat p, 
    CompressionMode c
)
public byte[] Save (
    PersistenceFormat p, 
    CompressionMode c
)
public function Save (
    p : PersistenceFormat, 
    c : CompressionMode
) : byte[]
Not applicable.

Parameters

  • p
    A member of the PersistenceFormat enumeration that indicates the format of the persisted ink.
  • c
    A member of the CompressionMode enumeration that specifies the compression mode of the persisted ink.

Return Value

The Byte array that contains the persisted ink.

Remarks

Attempting to save an empty Ink object in Gif format generates an error.

Note

When calling the Save method with the p parameter set toBase64InkSerializedFormat, the return value is a null-terminated byte array. To write the saved ink to an XML file, first remove the last byte from the array before converting the array to an 8-bit Unicode Transformation Format (UTF-8)-encoded string.

Example

This C# example saves the Ink object in the InkCollector object, theInkCollector, in a Byte array, theSavedInk. The example later restores the ink in a new Ink object, theNewInk. The ink is stored in Ink Serialized Format (ISF) using the maximum compression.

byte [] theSavedInk =
    theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat,
        CompressionMode.Maximum);
// ...
Ink theNewInk = new Ink();
theNewInk.Load(theSavedInk);

This Microsoft Visual Basic.NET example saves the Ink object in the InkCollector object, theInkCollector, in a Byte array, theSavedInk. The example later restores the ink in a new Ink object, theNewInk. The ink is stored in ISF using the maximum compression.

Dim theSavedInk () as Byte = _
    theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat, _
        CompressionMode.Maximum)
'...
Dim theNewInk As New Ink()
theNewInk.Load(theSavedInk)

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class
Ink Members
Microsoft.Ink Namespace
Load
PersistenceFormat
CompressionMode