Rediger

Del via


SerializerWriter.CreateVisualsCollator Method

Definition

When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements to the serialization Stream.

Overloads

CreateVisualsCollator()

When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements.

CreateVisualsCollator(PrintTicket, PrintTicket)

When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements together with the given print tickets.

Examples

The following example shows the use of the CreateVisualsCollator method.

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

CreateVisualsCollator()

When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements.

public:
 abstract System::Windows::Documents::Serialization::SerializerWriterCollator ^ CreateVisualsCollator();
public abstract System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator ();
abstract member CreateVisualsCollator : unit -> System.Windows.Documents.Serialization.SerializerWriterCollator
Public MustOverride Function CreateVisualsCollator () As SerializerWriterCollator

Returns

A SerializerWriterCollator that writes collated Visual elements to the document output serialization Stream.

Examples

The following example shows the use of the CreateVisualsCollator method.

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

Notes to Implementers

CreateVisualsCollator() should return a SerializerWriterCollator that writes to the same serialization Stream as the SerializerWriter that is used to create it.

Applies to

CreateVisualsCollator(PrintTicket, PrintTicket)

When overridden in a derived class, returns a SerializerWriterCollator that writes collated Visual elements together with the given print tickets.

public:
 abstract System::Windows::Documents::Serialization::SerializerWriterCollator ^ CreateVisualsCollator(System::Printing::PrintTicket ^ documentSequencePT, System::Printing::PrintTicket ^ documentPT);
public abstract System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator (System.Printing.PrintTicket documentSequencePT, System.Printing.PrintTicket documentPT);
abstract member CreateVisualsCollator : System.Printing.PrintTicket * System.Printing.PrintTicket -> System.Windows.Documents.Serialization.SerializerWriterCollator
Public MustOverride Function CreateVisualsCollator (documentSequencePT As PrintTicket, documentPT As PrintTicket) As SerializerWriterCollator

Parameters

documentSequencePT
PrintTicket

The default print preferences for FixedDocumentSequence content.

documentPT
PrintTicket

The default print preferences for FixedDocument content.

Returns

A SerializerWriterCollator that writes collated Visual elements to the document output serialization Stream.

Examples

The following example shows the use of the CreateVisualsCollator method.

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

documentSequencePT or documentPT can be null if there are no preferred print settings.

This method does not validate or modify the given print tickets for a particular PrintQueue. If needed, use the PrintQueue.MergeAndValidatePrintTicket method to create a PrintQueue-specific PrintTicket that is valid for a given printer.

Notes to Implementers

CreateVisualsCollator(PrintTicket, PrintTicket) should return a SerializerWriterCollator that writes to the same serialization Stream as the SerializerWriter that creates it.

Applies to