Share via


Ink.Save Method (PersistenceFormat)

Converts the Ink object to the specified format, saves it by using the Default, 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 _
) As Byte()
'Usage
Dim instance As Ink
Dim p As PersistenceFormat
Dim returnValue As Byte()

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

Parameters

  • p
    A member of the PersistenceFormat enumeration that indicates the format 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 to Base64InkSerializedFormat, 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).

byte [] theSavedInk =
    theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat);
// ...
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.

Dim theSavedInk () as Byte = _
    theInkCollector.Ink.Save(PersistenceFormat.InkSerializedFormat)
'...
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
Ink.Load
PersistenceFormat
CompressionMode