PrintQueue.CreateXpsDocumentWriter 方法

定義

建立 XpsDocumentWriter 物件。

多載

CreateXpsDocumentWriter(PrintDocumentImageableArea, PageRangeSelection, PageRange)

建立 XpsDocumentWriter 物件,開啟 Windows 通用列印對話方塊,在對話方塊中輸入頁面範圍和列印工作的描述,並傳回 ref (Visual Basic 中為 ByRef) 參數,這個參數表示可影像化區域和媒體維度的詳細資訊。

CreateXpsDocumentWriter(PrintDocumentImageableArea)

建立 XpsDocumentWriter 物件,開啟 Windows 通用列印對話方塊,並傳回 ref (Visual Basic 中為 ByRef) 參數,這個參數表示可影像化區域和媒體維度的詳細資訊。

CreateXpsDocumentWriter(PrintQueue)

建立 XpsDocumentWriter 物件,並將它與指定的列印佇列相關聯。

CreateXpsDocumentWriter(Double, Double)

使用指定的維度 (Dimension) 建立 XpsDocumentWriter 物件。

CreateXpsDocumentWriter(String, PrintDocumentImageableArea)

建立 XpsDocumentWriter 物件,開啟 Windows 通用列印對話方塊 (並為其提供工作描述),且傳回 ref (Visual Basic 中為ByRef) 參數,這個參數表示可影像化區域和媒體維度的詳細資訊。

CreateXpsDocumentWriter(String, PrintDocumentImageableArea, PageRangeSelection, PageRange)

建立 XpsDocumentWriter 物件,開啟 Windows 通用列印對話方塊,在對話方塊中輸入頁面範圍,並傳回 ref (Visual Basic 中為 ByRef) 參數,這個參數表示可影像化區域和媒體維度的詳細資訊。

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。 (參數 documentImageableAreapageRangeSelectionpageRange 都是使用者初始化並在關閉對話方塊時傳回的 ref [Visual Basic 中為 ByRef] 參數,因此每個參數都代表額外傳回的項目)。

屬性

備註

許多印表機最多需要每分之一英吋的未列印空間周圍每頁邊緣,才能將紙張貼上,並透過印表機移動。 否則,手寫筆會使紙張流程機制不足。 可列印的區域是「可影像區域」。

此類型 PrintDocumentImageableArea 沒有公用建構函式。 因此, documentImageableArea 變數必須宣告並指派給 null ,然後才傳遞至 方法。 這個方法會顯示 PrintDialog 需要使用者輸入的 。 使用者會在對話框上設定列印作業, (包括選取印表機、紙張大小、方向和頁面範圍) 。 當對話框關閉並具有值,pageRangeSelectionpageRangedocumentImageableArea指向初始化其屬性的實際物件時。

如果使用者取消或關閉對話框,則傳回值為 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)

使用指定的維度 (Dimension) 建立 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。 (參數 documentImageableAreapageRangeSelectionpageRange 都是使用者初始化並在關閉對話方塊時傳回的 ref [Visual Basic 中為 ByRef] 參數,因此每個參數都代表額外傳回的項目)。

屬性

備註

許多印表機最多需要每分之一英吋的未列印空間周圍每頁邊緣,才能將紙張貼上,並透過印表機移動。 否則,手寫筆會使紙張流程機制不足。 可列印的區域是「可影像區域」。

此類型 PrintDocumentImageableArea 沒有公用建構函式。 因此, documentImageableArea 變數必須宣告並指派給 null ,然後才傳遞至 方法。 這個方法會顯示 PrintDialog 需要使用者輸入的 。 使用者會在對話框上設定列印作業, (包括選取印表機、紙張大小、方向和頁面範圍) 。 當對話框關閉並具有值,pageRangeSelectionpageRangedocumentImageableArea指向初始化其屬性的實際物件時。

如果使用者取消或關閉對話框,則傳回值為 null。 因此,應用程式必須檢查 null 傳回值。

另請參閱

適用於