Redigera

Dela via


PrintQueue.CreateXpsDocumentWriter Method

Definition

Creates an XpsDocumentWriter object.

Overloads

CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)

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

CreateXpsDocumentWriter(PrintDocumentImageableArea)

Creates an 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.

CreateXpsDocumentWriter(PrintQueue)

Creates an XpsDocumentWriter object and associates it with the specified print queue.

CreateXpsDocumentWriter(Double, Double)

Creates an XpsDocumentWriter object with the specified dimensions.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

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.

CreateXpsDocumentWriter(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.

CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)

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

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(System::Printing::PrintDocumentImageableArea ^ % documentImageableArea, System::Windows::Controls::PageRangeSelection % pageRangeSelection, System::Windows::Controls::PageRange % pageRange);
[System.Security.SecurityCritical]
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref System.Printing.PrintDocumentImageableArea documentImageableArea, ref System.Windows.Controls.PageRangeSelection pageRangeSelection, ref System.Windows.Controls.PageRange pageRange);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref System.Printing.PrintDocumentImageableArea documentImageableArea, ref System.Windows.Controls.PageRangeSelection pageRangeSelection, ref System.Windows.Controls.PageRange pageRange);
[<System.Security.SecurityCritical>]
static member CreateXpsDocumentWriter : PrintDocumentImageableArea * PageRangeSelection * PageRange -> System.Windows.Xps.XpsDocumentWriter
static member CreateXpsDocumentWriter : PrintDocumentImageableArea * PageRangeSelection * PageRange -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (ByRef documentImageableArea As PrintDocumentImageableArea, ByRef pageRangeSelection As PageRangeSelection, ByRef pageRange As PageRange) As XpsDocumentWriter

Parameters

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

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

pageRange
PageRange

The range of pages that is printed.

Returns

An XpsDocumentWriter that writes XPS data to a stream. This can be null. (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.)

Attributes

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 null and only then passed to the method. This method displays a PrintDialog requiring input from the user. The user configures their 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 null. As a consequence, the return value must be checked for null by your application.

See also

Applies to

CreateXpsDocumentWriter(PrintDocumentImageableArea)

Creates an 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.

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(System::Printing::PrintDocumentImageableArea ^ % documentImageableArea);
[System.Security.SecurityCritical]
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref System.Printing.PrintDocumentImageableArea documentImageableArea);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref System.Printing.PrintDocumentImageableArea documentImageableArea);
[<System.Security.SecurityCritical>]
static member CreateXpsDocumentWriter : PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
static member CreateXpsDocumentWriter : PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (ByRef documentImageableArea As PrintDocumentImageableArea) As XpsDocumentWriter

Parameters

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

Returns

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

Attributes

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

See also

Applies to

CreateXpsDocumentWriter(PrintQueue)

Creates an XpsDocumentWriter object and associates it with the specified print queue.

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(System::Printing::PrintQueue ^ printQueue);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (System.Printing.PrintQueue printQueue);
static member CreateXpsDocumentWriter : System.Printing.PrintQueue -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (printQueue As PrintQueue) As XpsDocumentWriter

Parameters

printQueue
PrintQueue

A print queue to print the XPS document.

Returns

An XpsDocumentWriter that writes to an XPS stream.

Examples

The following example shows how to use this method to create an XpsDocumentWriter.

// -------------------- GetPrintXpsDocumentWriter() -------------------
/// <summary>
///   Returns an XpsDocumentWriter for the default print queue.</summary>
/// <returns>
///   An XpsDocumentWriter for the default print queue.</returns>
private XpsDocumentWriter GetPrintXpsDocumentWriter()
{
    // Create a local print server
    LocalPrintServer ps = new LocalPrintServer();

    // Get the default print queue
    PrintQueue pq = ps.DefaultPrintQueue;

    // Get an XpsDocumentWriter for the default print queue
    XpsDocumentWriter xpsdw = PrintQueue.CreateXpsDocumentWriter(pq);
    return xpsdw;
}// end:GetPrintXpsDocumentWriter()
' -------------------- GetPrintXpsDocumentWriter() -------------------
''' <summary>
'''   Returns an XpsDocumentWriter for the default print queue.</summary>
''' <returns>
'''   An XpsDocumentWriter for the default print queue.</returns>
Private Function GetPrintXpsDocumentWriter() As XpsDocumentWriter
    ' Create a local print server
    Dim ps As New LocalPrintServer()

    ' Get the default print queue
    Dim pq As PrintQueue = ps.DefaultPrintQueue

    ' Get an XpsDocumentWriter for the default print queue
    Dim xpsdw As XpsDocumentWriter = PrintQueue.CreateXpsDocumentWriter(pq)
    Return xpsdw
End Function ' end:GetPrintXpsDocumentWriter()

See also

Applies to

CreateXpsDocumentWriter(Double, Double)

Creates an XpsDocumentWriter object with the specified dimensions.

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(double % width, double % height);
[System.Security.SecurityCritical]
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref double width, ref double height);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (ref double width, ref double height);
[<System.Security.SecurityCritical>]
static member CreateXpsDocumentWriter : double * double -> System.Windows.Xps.XpsDocumentWriter
static member CreateXpsDocumentWriter : double * double -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (ByRef width As Double, ByRef height As Double) As XpsDocumentWriter

Parameters

width
Double

The width of the XPS document.

height
Double

The height of the XPS document.

Returns

An XpsDocumentWriter that writes to an XPS stream. This can be null.

Attributes

Remarks

This method displays a PrintDialog requiring input from the user. 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.

See also

Applies to

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

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.

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(System::String ^ jobDescription, System::Printing::PrintDocumentImageableArea ^ % documentImageableArea);
[System.Security.SecurityCritical]
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (string jobDescription, ref System.Printing.PrintDocumentImageableArea documentImageableArea);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (string jobDescription, ref System.Printing.PrintDocumentImageableArea documentImageableArea);
[<System.Security.SecurityCritical>]
static member CreateXpsDocumentWriter : string * PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
static member CreateXpsDocumentWriter : string * PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (jobDescription As String, ByRef documentImageableArea As PrintDocumentImageableArea) As XpsDocumentWriter

Parameters

jobDescription
String

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

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

Returns

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

Attributes

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

See also

Applies to

CreateXpsDocumentWriter(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.

public:
 static System::Windows::Xps::XpsDocumentWriter ^ CreateXpsDocumentWriter(System::String ^ jobDescription, System::Printing::PrintDocumentImageableArea ^ % documentImageableArea, System::Windows::Controls::PageRangeSelection % pageRangeSelection, System::Windows::Controls::PageRange % pageRange);
[System.Security.SecurityCritical]
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (string jobDescription, ref System.Printing.PrintDocumentImageableArea documentImageableArea, ref System.Windows.Controls.PageRangeSelection pageRangeSelection, ref System.Windows.Controls.PageRange pageRange);
public static System.Windows.Xps.XpsDocumentWriter CreateXpsDocumentWriter (string jobDescription, ref System.Printing.PrintDocumentImageableArea documentImageableArea, ref System.Windows.Controls.PageRangeSelection pageRangeSelection, ref System.Windows.Controls.PageRange pageRange);
[<System.Security.SecurityCritical>]
static member CreateXpsDocumentWriter : string * PrintDocumentImageableArea * PageRangeSelection * PageRange -> System.Windows.Xps.XpsDocumentWriter
static member CreateXpsDocumentWriter : string * PrintDocumentImageableArea * PageRangeSelection * PageRange -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (jobDescription As String, ByRef documentImageableArea As PrintDocumentImageableArea, ByRef pageRangeSelection As PageRangeSelection, ByRef pageRange As PageRange) As XpsDocumentWriter

Parameters

jobDescription
String

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

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

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

pageRange
PageRange

The range of pages that is printed.

Returns

An XpsDocumentWriter that writes XPS data to a stream. This can be null. (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.)

Attributes

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 null and only then passed to the method. This method displays a PrintDialog requiring input from the user. The user configures their 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 null. As a consequence, the return value must be checked for null by your application.

See also

Applies to