PrintQueue::CreateXpsDocumentWriter Method (String^, PrintDocumentImageableArea^%)


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

Creates an XpsDocumentWriter object, opens a Windows common print dialog (and provides it a job description) and returns a ref (ByRef in Visual Basic) parameter that represents information about the imageable area and the dimensions of the media.

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

static XpsDocumentWriter^ CreateXpsDocumentWriter(
	String^ jobDescription,
	PrintDocumentImageableArea^% documentImageableArea


Type: System::String^

A name for the print job. It appears in the Windows printing user interface.

Type: System.Printing::PrintDocumentImageableArea^%

A reference to an object that contains the dimensions of the area of the page on which the device can print. Since its data type has no public constructor, this parameter is passed uninitialized.

Return Value

Type: System.Windows.Xps::XpsDocumentWriter^

An XpsDocumentWriter that writes XPS data to a stream. This can be null. (The parameter documentImageableArea is a ref [ByRef in Visual Basic] parameter that is initialized by the method, so it represents a second returned item.)

Many printers need up to a quarter of an inch of unprinted space around the edges of each page to grip the paper and move it through the printer. Otherwise toner would foul the paper flow mechanism. The area which can be printed is the "imageable area."

The type PrintDocumentImageableArea has no public constructor. Hence, the variable documentImageableArea must be declared and assigned to null and only then passed to the method. This method displays a PrintDialog requiring input from the user. After the user has selected a printer, paper size, and orientation and closed the dialog, documentImageableArea points to an actual object, and its properties are initialized.

If the user cancels or closes the dialog, the return value is null. As a consequence, the return value must be checked for null by your application.

.NET Framework
Available since 3.0
Return to top