Version

SaveAsBinary(Stream) Method

Saves property information to a file in binary format.
Syntax
'Declaration
 
Public Overloads Sub SaveAsBinary( _
   ByVal stream As Stream _
) 
public void SaveAsBinary( 
   Stream stream
)

Parameters

stream
The System.IO.Stream to save the property information to.
Remarks

The SaveAsBinary method is used in conjunction with the LoadFromBinary(Stream) method to persist the property settings of the print document.

Example
The following example demonstrates how to use the SaveAsBinary and LoadFromBinary methods to serialize and deserialize an UltraPrintDocument.

Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.Printing

    Private binaryMemoryStream As System.IO.MemoryStream = Nothing

    Private Sub btnBinarySave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBinarySave.Click
        If Not Me.binaryMemoryStream Is Nothing Then
            Me.binaryMemoryStream.Close()
        End If

        Me.binaryMemoryStream = New System.IO.MemoryStream()

        Me.UltraPrintDocument1.SaveAsBinary(Me.binaryMemoryStream)
    End Sub

    Private Sub btnBinaryLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBinaryLoad.Click
        If Me.binaryMemoryStream Is Nothing Then
            Return
        End If

        Me.binaryMemoryStream.Position = 0
        Me.UltraPrintDocument1.LoadFromBinary(Me.binaryMemoryStream)
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.Printing;

		private System.IO.MemoryStream		binaryMemoryStream = null;

		private void btnBinarySave_Click(object sender, System.EventArgs e)
		{
			if (this.binaryMemoryStream != null)
				this.binaryMemoryStream.Close();

			this.binaryMemoryStream = new System.IO.MemoryStream();

			this.ultraPrintDocument1.SaveAsBinary(this.binaryMemoryStream);
		}

		private void btnBinaryLoad_Click(object sender, System.EventArgs e)
		{
			if (this.binaryMemoryStream == null)
				return;

			this.binaryMemoryStream.Position = 0;
			this.ultraPrintDocument1.LoadFromBinary(this.binaryMemoryStream);
		}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also