PrintTicket Constructor (Stream)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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.

Exception Condition

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
Available since 3.0
Return to top