This documentation is archived and is not being maintained.

PrintQueue.CreateXpsDocumentWriter Method (PrintDocumentImageableArea)

Creates a XpsDocumentWriter object, opens a Windows common print dialog 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)

public static XpsDocumentWriter CreateXpsDocumentWriter (
	ref PrintDocumentImageableArea documentImageableArea
)
public static XpsDocumentWriter CreateXpsDocumentWriter (
	/** @ref */ PrintDocumentImageableArea documentImageableArea
)
Not applicable.

Parameters

documentImageableArea

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

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

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 a null reference (Nothing in Visual Basic) and only then passed to the method. This method will display a PrintDialog requiring input from the user. After the user has selected a printer, paper size, and orientation and closed the dialog, documentImageableArea will point to an actual object and its properties will be initialized.

If the user cancels or closes the dialog, the return value will be a null reference (Nothing in Visual Basic). As a consequence, the return value must be checked for a null reference (Nothing in Visual Basic) by your application.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: