Export (0) Print
Expand All

PrintQueue.CreateXpsDocumentWriter Method (String, PrintDocumentImageableArea, PageRangeSelection, PageRange)

Creates an XpsDocumentWriter object, opens a Windows common print dialog, provides the dialog with a page range, 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)

'Declaration
Public Shared Function CreateXpsDocumentWriter ( _
	jobDescription As String, _
	ByRef documentImageableArea As PrintDocumentImageableArea, _
	ByRef pageRangeSelection As PageRangeSelection, _
	ByRef pageRange As PageRange _
) As XpsDocumentWriter

Parameters

jobDescription
Type: System.String

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

documentImageableArea
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.

pageRangeSelection
Type: System.Windows.Controls.PageRangeSelection

A value that specifies whether to print all pages or only a range that is specified by the user.

pageRange
Type: System.Windows.Controls.PageRange

The range of pages that is printed.

Return Value

Type: System.Windows.Xps.XpsDocumentWriter
An XpsDocumentWriter that writes XPS data to a stream. This can be Nothing. (The parameters documentImageableArea, pageRangeSelection, and pageRange are all ref [ByRef in Visual Basic] parameters that are initialized by the user and returned when the dialog is closed, so each represents an additional 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 Nothing and only then passed to the method. This method displays a PrintDialog requiring input from the user. The user configures his print job on the dialog (including selecting a printer, paper size, orientation, and page range). When the dialog is closed, pageRangeSelection and pageRange have values, and documentImageableArea points to an actual object whose properties are initialized.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Show:
© 2014 Microsoft