Bewerken

Delen via


VisualsToXpsDocument.Write Method

Definition

Writes a Visualsynchronously to an XpsDocument or a PrintQueue.

Overloads

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.

Write(Visual)

Writes a Visual synchronously to an XpsDocument or a PrintQueue.

public:
 override void Write(System::Windows::Media::Visual ^ visual);
public override void Write (System.Windows.Media.Visual visual);
override this.Write : System.Windows.Media.Visual -> unit
Public Overrides Sub Write (visual As Visual)

Parameters

visual
Visual

The Visual that is written.

Examples

The following example shows how to use this method 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

Applies to

Write(Visual, PrintTicket)

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

public:
 override void Write(System::Windows::Media::Visual ^ visual, System::Printing::PrintTicket ^ printTicket);
public override void Write (System.Windows.Media.Visual visual, System.Printing.PrintTicket printTicket);
override this.Write : System.Windows.Media.Visual * System.Printing.PrintTicket -> unit
Public Overrides Sub Write (visual As Visual, printTicket As PrintTicket)

Parameters

visual
Visual

The Visual that is written.

printTicket
PrintTicket

A PrintTicket that represents the default printing preferences for the document.

Remarks

This method does not validate or modify the specified printTicket for a particular PrintQueue. If necessary, use the MergeAndValidatePrintTicket method to create a PrintTicket that is specific to the PrintQueue and is valid for a specified printer.

Applies to