Export (0) Print
Expand All

PrintTicket.Collation Property

Gets or sets a value indicating whether the printer collates its output.

Namespace: System.Printing
Assembly: ReachFramework (in reachframework.dll)

public Nullable<Collation> Collation { get; set; }
/** @property */
public Nullable<Collation> get_Collation ()

/** @property */
public void set_Collation (Nullable<Collation> value)

public function get Collation () : Nullable<Collation>

public function set Collation (value : Nullable<Collation>)

You cannot use this property in XAML.

Property Value

A Collation value indicating whether the printer collates its output.

Exception typeCondition

ArgumentOutOfRangeException

Calling code has attempted to set the property to a value that is not in the Collation enumeration.

A a null reference (Nothing in Visual Basic) value for this property means that this feature setting is not specified. Also, when the value is a null reference (Nothing in Visual Basic), the XML versions of the PrintTicket (see SaveTo and GetXmlStream) will not contain any markup for this feature.

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

You can test for the options that the printer supports by using the CollationCapability property.

The following example shows how to use this property when testing a printer's capabilities and configuring a print job to take advantage of them. For the complete example, see Creating an XPS Document Sample.

// ---------------------- 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 printCapabilites = printQueue.GetPrintCapabilities();

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

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

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

    return printTicket;
}// end:GetPrintTicketFromPrinter()

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show:
© 2014 Microsoft