PrintCapabilities.CollationCapability Property

Definition

Gets a collection of values that identify the collation capabilities of a printer.

C#
public System.Collections.ObjectModel.ReadOnlyCollection<System.Printing.Collation> CollationCapability { get; }

Property Value

A ReadOnlyCollection<T> of Collation values.

Examples

The following example shows how to use this property to determine the capabilities of a specific printer and how to configure a print job to take advantage of them.

C#
// ---------------------- GetPrintTicketFromPrinter -----------------------
/// <summary>
///   Returns a PrintTicket based on the current default printer.</summary>
/// <returns>
///   A PrintTicket for the current local default printer.</returns>
private PrintTicket GetPrintTicketFromPrinter()
{
    PrintQueue printQueue = null;

    LocalPrintServer localPrintServer = new LocalPrintServer();

    // Retrieving collection of local printer on user machine
    PrintQueueCollection localPrinterCollection =
        localPrintServer.GetPrintQueues();

    System.Collections.IEnumerator localPrinterEnumerator =
        localPrinterCollection.GetEnumerator();

    if (localPrinterEnumerator.MoveNext())
    {
        // Get PrintQueue from first available printer
        printQueue = (PrintQueue)localPrinterEnumerator.Current;
    }
    else
    {
        // No printer exist, return null PrintTicket
        return null;
    }

    // Get default PrintTicket from printer
    PrintTicket printTicket = printQueue.DefaultPrintTicket;

    PrintCapabilities printCapabilities = printQueue.GetPrintCapabilities();

    // Modify PrintTicket
    if (printCapabilities.CollationCapability.Contains(Collation.Collated))
    {
        printTicket.Collation = Collation.Collated;
    }

    if ( printCapabilities.DuplexingCapability.Contains(
            Duplexing.TwoSidedLongEdge) )
    {
        printTicket.Duplexing = Duplexing.TwoSidedLongEdge;
    }

    if (printCapabilities.StaplingCapability.Contains(Stapling.StapleDualLeft))
    {
        printTicket.Stapling = Stapling.StapleDualLeft;
    }

    return printTicket;
}// end:GetPrintTicketFromPrinter()

Remarks

A standard printer typically collates output by printing every page of the first copy, then every page of the second copy, and so on. When a standard printer does not collate, it prints every copy of the first page, then every copy of the second page, and so on.

Some printers are specially equipped with collating bins. The printing sequence for these specially equipped printers may differ from those of standard printers; however the outcome is the same: each copy of a multi-paged print job contains all its pages in the proper sequence without manual sorting.

If the printer does not support collation, the collection is empty.

This property corresponds to the Print Schema's DocumentCollate keyword, not the JobCollateAllDocuments keyword.

Applies to

Product Versions
.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