PrintQueue.CreateXpsDocumentWriter 方法     
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建一个 XpsDocumentWriter 对象。
重载
| CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange) | 
						 创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供页面范围和打印作业说明,并返回   | 
        	
| CreateXpsDocumentWriter(PrintDocumentImageableArea) | 
						 创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框并返回   | 
        	
| CreateXpsDocumentWriter(PrintQueue) | 
						 创建一个 XpsDocumentWriter 对象并将其与指定的打印队列关联。  | 
        	
| CreateXpsDocumentWriter(Double, Double) | 
						 创建具有指定维度的 XpsDocumentWriter 对象。  | 
        	
| CreateXpsDocumentWriter(String, PrintDocumentImageableArea) | 
						 创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框(同时为其提供一个作业说明)并返回   | 
        	
| CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange) | 
						 创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供一个页面范围并返回   | 
        	
CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)
创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供页面范围和打印作业说明,并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。
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
	参数
- documentImageableArea
 - PrintDocumentImageableArea
 
对包含设备可以打印的页面区域维度的对象的引用。 由于该参数的数据类型无公共构造函数,因此它以未初始化状态进行传递。
- pageRangeSelection
 - PageRangeSelection
 
指定是打印所有页面,还是只打印用户指定页面范围的值。
- pageRange
 - PageRange
 
打印的页面范围。
返回
将 XPS 数据写入流的 XpsDocumentWriter。 它可以是 null。 参数 documentImageableArea、pageRangeSelection 和 pageRange 全都为 ref [在 Visual Basic 中为 ByRef] 参数,这些参数由用户初始化并在对话框关闭时返回,因此,每个参数表示一个另外的返回项。)
- 属性
 
注解
许多打印机需要每页边缘四分之一英寸的未打印空间,以抓取纸张并将其移动到打印机上。 否则碳粉会污染纸张流动机制。 可打印的区域是“可图像区域”。
类型 PrintDocumentImageableArea 没有公共构造函数。 因此, documentImageableArea 变量必须声明并分配给 null ,然后才传递给 方法。 此方法显示 PrintDialog 需要用户输入的 。 用户在对话框 (配置打印作业,包括选择打印机、纸张大小、方向和页面范围) 。 当对话框处于关闭状态, pageRangeSelection 并且 pageRange 具有值,并 documentImageableArea 指向初始化其属性的实际对象时。
如果用户取消或关闭对话框,则返回值为 null。 因此,应用程序必须检查 null 返回值。
另请参阅
适用于
CreateXpsDocumentWriter(PrintDocumentImageableArea)
创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。
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
	参数
- documentImageableArea
 - PrintDocumentImageableArea
 
对包含设备可以打印的页面区域维度的对象的引用。 由于该参数的数据类型无公共构造函数,因此它以未初始化状态进行传递。
返回
将 XPS 数据写入流的 XpsDocumentWriter。 它可以是 null。 (参数 documentImageableArea 是一个 ref [在 Visual Basic 中为 ByRef] 参数,已经过该方法初始化,因此表示又一个返回项。)
- 属性
 
注解
许多打印机需要每页边缘四分之一英寸的未打印空间,以抓取纸张并将其移动到打印机上。 否则碳粉会污染纸张流动机制。 可打印的区域是“可图像区域”。
类型 PrintDocumentImageableArea 没有公共构造函数。 因此, documentImageableArea 变量必须声明并分配给 null ,然后才传递给 方法。 此方法显示 PrintDialog 需要用户输入的 。 用户选择打印机、纸张大小和方向并关闭对话框后, documentImageableArea 指向实际对象并初始化其属性。
如果用户取消或关闭对话框,则返回值为 null。 因此,应用程序必须检查 null 返回值。
另请参阅
适用于
CreateXpsDocumentWriter(PrintQueue)
创建一个 XpsDocumentWriter 对象并将其与指定的打印队列关联。
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
	参数
- printQueue
 - PrintQueue
 
打印 XPS 文档的打印队列。
返回
写入 XPS 流的 XpsDocumentWriter。
示例
以下示例演示如何使用此方法创建 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 对象。
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
	参数
- width
 - Double
 
XPS 文档的宽度。
- height
 - Double
 
XPS 文档的高度。
返回
写入 XPS 流的 XpsDocumentWriter。 它可以是 null。
- 属性
 
注解
此方法显示 PrintDialog 需要用户输入的 。 如果用户取消或关闭对话框,则返回值为 null。 因此,应用程序必须检查 null 返回值。
另请参阅
适用于
CreateXpsDocumentWriter(String, PrintDocumentImageableArea)
创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框(同时为其提供一个作业说明)并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。
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
	参数
- jobDescription
 - String
 
打印作业的名称。 该名称出现在 Windows 打印用户界面中。
- documentImageableArea
 - PrintDocumentImageableArea
 
对包含设备可以打印的页面区域维度的对象的引用。 由于该参数的数据类型无公共构造函数,因此它以未初始化状态进行传递。
返回
将 XPS 数据写入流的 XpsDocumentWriter。 它可以是 null。 (参数 documentImageableArea 是一个 ref [在 Visual Basic 中为 ByRef] 参数,已经过该方法初始化,因此表示又一个返回项。)
- 属性
 
注解
许多打印机需要每页边缘四分之一英寸的未打印空间,以抓取纸张并将其移动到打印机上。 否则碳粉会污染纸张流动机制。 可打印的区域是“可图像区域”。
类型 PrintDocumentImageableArea 没有公共构造函数。 因此, documentImageableArea 变量必须声明并分配给 null ,然后才传递给 方法。 此方法显示 PrintDialog 需要用户输入的 。 用户选择打印机、纸张大小和方向并关闭对话框后, documentImageableArea 指向实际对象,并初始化其属性。
如果用户取消或关闭对话框,则返回值为 null。 因此,应用程序必须检查 null 返回值。
另请参阅
适用于
CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange)
创建 XpsDocumentWriter 对象,打开 Windows 通用打印对话框,为对话框提供一个页面范围并返回 ref(Visual Basic 中为 ByRef)参数,该参数表示有关可绘制区域和介质维度的信息。
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
	参数
- jobDescription
 - String
 
打印作业的名称。 该名称出现在 Windows 打印用户界面中。
- documentImageableArea
 - PrintDocumentImageableArea
 
对包含设备可以打印的页面区域维度的对象的引用。 由于该参数的数据类型无公共构造函数,因此它以未初始化状态进行传递。
- pageRangeSelection
 - PageRangeSelection
 
指定是打印所有页面,还是只打印用户指定页面范围的值。
- pageRange
 - PageRange
 
打印的页面范围。
返回
将 XPS 数据写入流的 XpsDocumentWriter。 它可以是 null。 参数 documentImageableArea、pageRangeSelection 和 pageRange 全都为 ref [在 Visual Basic 中为 ByRef] 参数,这些参数由用户初始化并在对话框关闭时返回,因此,每个参数表示一个另外的返回项。)
- 属性
 
注解
许多打印机需要每页边缘四分之一英寸的未打印空间,以抓取纸张并将其移动到打印机上。 否则碳粉会污染纸张流动机制。 可打印的区域是“可图像区域”。
类型 PrintDocumentImageableArea 没有公共构造函数。 因此, documentImageableArea 变量必须声明并分配给 null ,然后才传递给 方法。 此方法显示 PrintDialog 需要用户输入的 。 用户在对话框 (配置打印作业,包括选择打印机、纸张大小、方向和页面范围) 。 当对话框处于关闭状态, pageRangeSelection 并且 pageRange 具有值,并 documentImageableArea 指向初始化其属性的实际对象时。
如果用户取消或关闭对话框,则返回值为 null。 因此,应用程序必须检查 null 返回值。