Share via


Ink.Save Method

Ink.Save Method

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

Definition

Visual Basic .NET Public Function Save( _
ByVal p As PersistenceFormat _
) As Byte()
C# public byte[] Save(
PersistenceFormat p
);
Managed C++ public: Byte* Save(
PersistenceFormat *p
) __gc[];

Parameters

> > >
p Microsoft.Ink.PersistenceFormat. A memeber of the PersistenceFormat enumeration that indicates the format of the persisted ink.

InkSerializedFormat0 Specifies ink that is persisted using ISF.

This is the most compact persistent representation of ink. It can be embedded within a binary document format or placed directly on the Clipboard.

Base64InkSerializedFormat1 Specifies ink that is persisted by encoding the ink serialized format (ISF) as a base64 stream.

This format is provided so ink can be encoded directly in an Extensible Markup Language (XML) or HTML file.

Gif2 Specifies ink that is persisted by using a Graphics Interchange Format (GIF) file that contains ISF as metadata embedded within the file.

This allows ink to be viewed in applications that are not ink-enabled and maintain its full ink fidelity when it returns to an ink-enabled application. This format is ideal when transporting ink content within an HTML file and making it usable by ink-enabled and ink-unaware applications.

Base64Gif3 Specifies ink that is persisted by using a base64 encoded fortified GIF.

This format is provided when ink is to be encoded directly in an XML or HTML file with later conversion into an image. A possible use of this is in an XML format that is generated to contain all ink information and used as a way to generate HTML through Extensible Stylesheet Language Transformations (XSLT).

Return Value

System.Byte[]. Returns the Byte Leave Site 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.

Examples

[C#]

This C# example saves the Ink object in the InkCollector object, theInkCollector, in a Byte Leave Site 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);

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example saves the Ink object in the InkCollector object, theInkCollector, in a Byte Leave Site 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)

See Also