Прочетете на английски Редактиране

Споделяне чрез


XpsDocumentWriter.CreateVisualsCollator Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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.

C#
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();
}

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.

C#
public override System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator();

Returns

The new VisualsToXpsDocument.

Examples

The following example shows how to use the CreateVisualsCollator method.

C#
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();
}

Remarks

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

Applies to

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CreateVisualsCollator(PrintTicket, PrintTicket)

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

C#
public override System.Windows.Documents.Serialization.SerializerWriterCollator CreateVisualsCollator(System.Printing.PrintTicket documentSequencePrintTicket, System.Printing.PrintTicket documentPrintTicket);

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

.NET Framework 4.8.1 и други версии
Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10