PrintQueue.CreateXpsDocumentWriter 方法

定义

创建一个 XpsDocumentWriter 对象。Creates an XpsDocumentWriter object.

重载

CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供页面范围和打印作业说明,并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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)

创建一个 XpsDocumentWriter 对象并将其与指定的打印队列关联。Creates an XpsDocumentWriter object and associates it with the specified print queue.

CreateXpsDocumentWriter(Double, Double)

创建具有指定维度的 XpsDocumentWriter 对象。Creates an XpsDocumentWriter object with the specified dimensions.

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框(同时为其提供一个作业说明)并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供一个页面范围并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供页面范围和打印作业说明,并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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);
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

参数

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.

返回

将 XPS 数据写入流的 XpsDocumentWriterAn XpsDocumentWriter that writes XPS data to a stream. 它可以是 nullThis can be null. 参数 documentImageableAreapageRangeSelectionpageRange 全都为 ref [在 Visual Basic 中为 ByRef] 参数,这些参数由用户初始化并在对话框关闭时返回,因此,每个参数表示一个另外的返回项。)(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.)

属性

注解

许多打印机需要在每个页面的边缘周围有一1/4 的 unprinted 空间来抓住纸张,并将其移动到打印机。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."

PrintDocumentImageableArea 类型没有公共构造函数。The type PrintDocumentImageableArea has no public constructor. 因此,必须声明变量 documentImageableArea 并将其分配给 null,然后将其传递给方法。Hence, the variable documentImageableArea must be declared and assigned to null and only then passed to the method. 此方法显示需要用户输入的 PrintDialogThis 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). 当对话框关闭时,pageRangeSelectionpageRange 具有值,documentImageableArea 指向其属性已初始化的实际对象。When the dialog is closed, pageRangeSelection and pageRange have values, and documentImageableArea points to an actual object whose properties are initialized.

如果用户取消或关闭对话框,则返回值为 nullIf the user cancels or closes the dialog, the return value is null. 因此,必须检查应用程序 null 的返回值。As a consequence, the return value must be checked for null by your application.

另请参阅

CreateXpsDocumentWriter(PrintDocumentImageableArea)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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);
static member CreateXpsDocumentWriter : PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (ByRef documentImageableArea As PrintDocumentImageableArea) As XpsDocumentWriter

参数

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.

返回

将 XPS 数据写入流的 XpsDocumentWriterAn XpsDocumentWriter that writes XPS data to a stream. 它可以是 nullThis can be null. (参数 documentImageableArea 是一个 ref [在 Visual Basic 中为 ByRef] 参数,已经过该方法初始化,因此表示又一个返回项。)(The parameter documentImageableArea is a ref [ByRef in Visual Basic] parameter that is initialized by the method, so it represents a second returned item.)

属性

注解

许多打印机需要在每个页面的边缘周围有一1/4 的 unprinted 空间来抓住纸张,并将其移动到打印机。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."

PrintDocumentImageableArea 类型没有公共构造函数。The type PrintDocumentImageableArea has no public constructor. 因此,必须声明变量 documentImageableArea 并将其分配给 null,然后将其传递给方法。Hence, the variable documentImageableArea must be declared and assigned to null and only then passed to the method. 此方法显示需要用户输入的 PrintDialogThis method displays a PrintDialog requiring input from the user. 用户选择打印机、纸张大小和方向并关闭对话框后,documentImageableArea 指向实际对象并初始化其属性。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.

如果用户取消或关闭对话框,则返回值为 nullIf the user cancels or closes the dialog, the return value is null. 因此,必须检查应用程序 null 的返回值。As a consequence, the return value must be checked for null by your application.

另请参阅

CreateXpsDocumentWriter(PrintQueue)

创建一个 XpsDocumentWriter 对象并将其与指定的打印队列关联。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

参数

printQueue
PrintQueue

打印 XPS 文档的打印队列。A print queue to print the XPS document.

返回

写入 XPS 流的 XpsDocumentWriterAn XpsDocumentWriter that writes to an XPS stream.

示例

下面的示例演示如何使用此方法创建 XpsDocumentWriterThe 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()

另请参阅

CreateXpsDocumentWriter(Double, Double)

创建具有指定维度的 XpsDocumentWriter 对象。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);
static member CreateXpsDocumentWriter : double * double -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (ByRef width As Double, ByRef height As Double) As XpsDocumentWriter

参数

width
Double

XPS 文档的宽度。The width of the XPS document.

height
Double

XPS 文档的高度。The height of the XPS document.

返回

写入 XPS 流的 XpsDocumentWriterAn XpsDocumentWriter that writes to an XPS stream. 它可以是 nullThis can be null.

属性

注解

此方法显示需要用户输入的 PrintDialogThis method displays a PrintDialog requiring input from the user. 如果用户取消或关闭对话框,则返回值为 nullIf the user cancels or closes the dialog, the return value is null. 因此,必须检查应用程序 null 的返回值。As a consequence, the return value must be checked for null by your application.

另请参阅

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框(同时为其提供一个作业说明)并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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);
static member CreateXpsDocumentWriter : string * PrintDocumentImageableArea -> System.Windows.Xps.XpsDocumentWriter
Public Shared Function CreateXpsDocumentWriter (jobDescription As String, ByRef documentImageableArea As PrintDocumentImageableArea) As XpsDocumentWriter

参数

jobDescription
String

打印作业的名称。A name for the print job. 该名称出现在 Windows 打印用户界面中。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.

返回

将 XPS 数据写入流的 XpsDocumentWriterAn XpsDocumentWriter that writes XPS data to a stream. 它可以是 nullThis can be null. (参数 documentImageableArea 是一个 ref [在 Visual Basic 中为 ByRef] 参数,已经过该方法初始化,因此表示又一个返回项。)(The parameter documentImageableArea is a ref [ByRef in Visual Basic] parameter that is initialized by the method, so it represents a second returned item.)

属性

注解

许多打印机需要在每个页面的边缘周围有一1/4 的 unprinted 空间来抓住纸张,并将其移动到打印机。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."

PrintDocumentImageableArea 类型没有公共构造函数。The type PrintDocumentImageableArea has no public constructor. 因此,必须声明变量 documentImageableArea 并将其分配给 null,然后将其传递给方法。Hence, the variable documentImageableArea must be declared and assigned to null and only then passed to the method. 此方法显示需要用户输入的 PrintDialogThis method displays a PrintDialog requiring input from the user. 用户选择打印机、纸张大小和方向并关闭对话框后,documentImageableArea 指向实际对象并初始化其属性。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.

如果用户取消或关闭对话框,则返回值为 nullIf the user cancels or closes the dialog, the return value is null. 因此,必须检查应用程序 null 的返回值。As a consequence, the return value must be checked for null by your application.

另请参阅

CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange)

创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供一个页面范围并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。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);
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

参数

jobDescription
String

打印作业的名称。A name for the print job. 该名称出现在 Windows 打印用户界面中。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.

返回

将 XPS 数据写入流的 XpsDocumentWriterAn XpsDocumentWriter that writes XPS data to a stream. 它可以是 nullThis can be null. 参数 documentImageableAreapageRangeSelectionpageRange 全都为 ref [在 Visual Basic 中为 ByRef] 参数,这些参数由用户初始化并在对话框关闭时返回,因此,每个参数表示一个另外的返回项。)(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.)

属性

注解

许多打印机需要在每个页面的边缘周围有一1/4 的 unprinted 空间来抓住纸张,并将其移动到打印机。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."

PrintDocumentImageableArea 类型没有公共构造函数。The type PrintDocumentImageableArea has no public constructor. 因此,必须声明变量 documentImageableArea 并将其分配给 null,然后将其传递给方法。Hence, the variable documentImageableArea must be declared and assigned to null and only then passed to the method. 此方法显示需要用户输入的 PrintDialogThis 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). 当对话框关闭时,pageRangeSelectionpageRange 具有值,documentImageableArea 指向其属性已初始化的实际对象。When the dialog is closed, pageRangeSelection and pageRange have values, and documentImageableArea points to an actual object whose properties are initialized.

如果用户取消或关闭对话框,则返回值为 nullIf the user cancels or closes the dialog, the return value is null. 因此,必须检查应用程序 null 的返回值。As a consequence, the return value must be checked for null by your application.

另请参阅

适用于