Edit

Share via


VisualsToXpsDocument Class

Definition

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

public ref class VisualsToXpsDocument : System::Windows::Documents::Serialization::SerializerWriterCollator
public class VisualsToXpsDocument : System.Windows.Documents.Serialization.SerializerWriterCollator
type VisualsToXpsDocument = class
    inherit SerializerWriterCollator
Public Class VisualsToXpsDocument
Inherits SerializerWriterCollator
Inheritance
VisualsToXpsDocument

Examples

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();
}
Private Sub SaveVisuals(ByVal xpsdw As XpsDocumentWriter, ByVal vc As List(Of Visual))
    ' Setup for writing multiple visuals
    Dim vToXpsD As VisualsToXpsDocument = CType(xpsdw.CreateVisualsCollator(), VisualsToXpsDocument)

    ' Iterate through all visuals in the collection
    For Each v As Visual In vc
        vToXpsD.Write(v) 'Write each visual to single page
    Next v

    ' End writing multiple visuals
    vToXpsD.EndBatchWrite()
End Sub

Remarks

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.

Methods

BeginBatchWrite()

Indicates that write operations can begin.

Cancel()

Cancels a synchronous writing operation.

CancelAsync()

Cancels an asynchronous writing operation.

EndBatchWrite()

Indicates that write operations must end.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
Write(Visual)

Writes a Visual synchronously to an XpsDocument or a PrintQueue.

Write(Visual, PrintTicket)

Writes a Visual synchronously to an XpsDocument or a PrintQueue and includes a PrintTicket.

WriteAsync(Visual)

Writes a Visual asynchronously to an XpsDocument or a PrintQueue.

WriteAsync(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.

WriteAsync(Visual, PrintTicket)

Writes a Visual asynchronously to an XpsDocument or a PrintQueue and includes a PrintTicket.

WriteAsync(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.

Applies to