This documentation is archived and is not being maintained.

PrintTicket Constructor (Stream)

Initializes a new instance of the PrintTicket class by using an XML stream (that contains a PrintTicket document) that complies with the XML Print Schema.

Namespace:  System.Printing
Assembly:  ReachFramework (in ReachFramework.dll)

public PrintTicket(
	Stream xmlStream


Type: System.IO.Stream
An XML stream that describes a print job and conforms to the Print Schema.


xmlStream is null.


xmlStream is not valid XML.

The constructor does not reset the read-write position of the stream back to its original position. Accordingly, you should reset it immediately after calling the constructor.

The entire PrintTicket document is stored in a non-public field in the object, including the XML elements within it that express less common features that are not represented by any of the public properties of the PrintTicket class. In fact, if the driver that produced the PrintTicket document is using a private extension of the Print Schema, that privately defined markup is also stored as part of the non-public PrintTicket document.

The private parts of the document, if any, are not validated by the constructor, but all Print Schema-defined parts are validated, including the parts that are not represented by any of the public properties of the PrintTicket class. Accordingly, the FormatException could be thrown even if all of the XML markup that corresponds to the public properties is valid.

When any of the properties of the PrintTicket are written to, this non-public PrintTicket document is changed as well.

It is this non-public PrintTicket document that is returned by the GetXmlStream and SaveTo methods.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.