편집

다음을 통해 공유


XpsDocumentWriter.CreateVisualsCollator Method

Definition

Returns a VisualsToXpsDocument that can write Visual objects to a document or print queue.

Overloads

CreateVisualsCollator()

Returns a VisualsToXpsDocument that can write Visual objects to a document or print queue.

CreateVisualsCollator(PrintTicket, PrintTicket)

Returns a VisualsToXpsDocument that can write Visual objects with PrintTicket settings to an XPS document or print queue.

Examples

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

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

CreateVisualsCollator()

Returns a VisualsToXpsDocument that can write Visual objects to a document or print queue.

public:
 override System::Windows::Documents::Serialization::SerializerWriterCollator ^ CreateVisualsCollator();
public override System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator ();
override this.CreateVisualsCollator : unit -> System.Windows.Documents.Serialization.SerializerWriterCollator
Public Overrides Function CreateVisualsCollator () As SerializerWriterCollator

Returns

The new VisualsToXpsDocument.

Examples

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

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

Applies to

CreateVisualsCollator(PrintTicket, PrintTicket)

Returns a VisualsToXpsDocument that can write Visual objects with PrintTicket settings to an XPS document or print queue.

public:
 override System::Windows::Documents::Serialization::SerializerWriterCollator ^ CreateVisualsCollator(System::Printing::PrintTicket ^ documentSequencePrintTicket, System::Printing::PrintTicket ^ documentPrintTicket);
public override System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator (System.Printing.PrintTicket documentSequencePrintTicket, System.Printing.PrintTicket documentPrintTicket);
override this.CreateVisualsCollator : System.Printing.PrintTicket * System.Printing.PrintTicket -> System.Windows.Documents.Serialization.SerializerWriterCollator
Public Overrides Function CreateVisualsCollator (documentSequencePrintTicket As PrintTicket, documentPrintTicket As PrintTicket) As SerializerWriterCollator

Parameters

documentSequencePrintTicket
PrintTicket

A PrintTicket that specifies the default printing preferences for the document sequence.

documentPrintTicket
PrintTicket

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

Returns

The new VisualsToXpsDocument that writes Visual elements with PrintTicket settings to the XpsDocument.

Remarks

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

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

Applies to