Export (0) Print
Expand All

VisualsToXpsDocument Class

Provides methods for writing Visual objects to XML Paper Specification (XPS) documents or to a print queue in batch mode. 

Namespace:  System.Windows.Xps
Assembly:  System.Printing (in System.Printing.dll)

public class VisualsToXpsDocument : SerializerWriterCollator

The VisualsToXpsDocument type exposes the following members.

  NameDescription
Public methodBeginBatchWriteIndicates that write operations can begin. (Overrides SerializerWriterCollator.BeginBatchWrite().)
Public methodCancelCancels a synchronous writing operation. (Overrides SerializerWriterCollator.Cancel().)
Public methodCancelAsyncCancels an asynchronous writing operation. (Overrides SerializerWriterCollator.CancelAsync().)
Public methodEndBatchWriteIndicates that write operations must end. (Overrides SerializerWriterCollator.EndBatchWrite().)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWrite(Visual)Writes a Visual synchronously to an XpsDocument or a PrintQueue. (Overrides SerializerWriterCollator.Write(Visual).)
Public methodWrite(Visual, PrintTicket)Writes a Visual synchronously to an XpsDocument or a PrintQueue and includes a PrintTicket. (Overrides SerializerWriterCollator.Write(Visual, PrintTicket).)
Public methodWriteAsync(Visual)Writes a Visual asynchronously to an XpsDocument or a PrintQueue. (Overrides SerializerWriterCollator.WriteAsync(Visual).)
Public methodWriteAsync(Visual, Object)Writes a Visual asynchronously to an XpsDocument or a PrintQueue and includes additional information that the caller wants to pass to an event handler. (Overrides SerializerWriterCollator.WriteAsync(Visual, Object).)
Public methodWriteAsync(Visual, PrintTicket)Writes a Visual asynchronously to an XpsDocument or a PrintQueue and includes a PrintTicket. (Overrides SerializerWriterCollator.WriteAsync(Visual, PrintTicket).)
Public methodWriteAsync(Visual, PrintTicket, Object)Writes a Visual asynchronously to an XpsDocument or a PrintQueue; also includes a PrintTicket and any additional information that the caller wants to pass to an event handler. (Overrides SerializerWriterCollator.WriteAsync(Visual, PrintTicket, Object).)
Top

Because this class has no constructor, use the CreateVisualsCollator method to create an instance.

The VisualsToXpsDocument writes to the same target XpsDocument or PrintQueue as the XpsDocumentWriter that creates the VisualsToXpsDocument.

Each Visual becomes a page in the document.

The following example shows how to create a visuals collator and use it to write to an XML Paper Specification (XPS) document.

private void SaveVisuals(XpsDocumentWriter xpsdw, List<Visual> vc)
{
    // Setup for writing multiple visuals
    VisualsToXpsDocument vToXpsD = (VisualsToXpsDocument)xpsdw.CreateVisualsCollator();

    // Iterate through all visuals in the collection 
    foreach (Visual v in vc)
    {
        vToXpsD.Write(v);   //Write each visual to single page
    }

    // End writing multiple visuals
    vToXpsD.EndBatchWrite();
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft