This documentation is archived and is not being maintained.

PrintQueue.CreateXpsDocumentWriter Method (PrintQueue)

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

Namespace: System.Printing
Assembly: System.Printing (in system.printing.dll)

public static XpsDocumentWriter CreateXpsDocumentWriter (
	PrintQueue printQueue
)
public static XpsDocumentWriter CreateXpsDocumentWriter (
	PrintQueue printQueue
)
public static function CreateXpsDocumentWriter (
	printQueue : PrintQueue
) : XpsDocumentWriter
Not applicable.

Parameters

printQueue

A print queue that will print the XPS document.

Return Value

An XpsDocumentWriter that writes to an XPS stream.

The following example shows how to use this method to create an XpsDocumentWriter. For the full sample, see Printing an XPS Document.

// -------------------- 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()

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: