Export (0) Print
Expand All
Expand Minimize

Stapling Enumeration

Specifies whether, and where, a printer staples a multi-page document.

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

public enum Stapling
<object property="enumerationMemberName" .../>

Member nameDescription
NoneThe document is not stapled.
SaddleStitchMultiple staples along the fold line. Also called saddle-stitch stapling.
StapleBottomLeftA single staple in the lower-left corner.
StapleBottomRightA single staple in the lower-right corner.
StapleDualBottomTwo staples along the lower edge.
StapleDualLeftTwo staples along the left edge.
StapleDualRightTwo staples along the right edge.
StapleDualTopTwo staples along the upper edge.
StapleTopLeftA single staple in the upper-left corner.
StapleTopRightA single staple in the upper-right corner.
UnknownThe feature (whose options are represented by this enumeration) is set to an option not defined in the Print Schema.

Use the values of this type primarily for these purposes:

  • As members of the StaplingCapability collection, which is a property of PrintCapabilities, these values indicate the types of stapling that a printer supports.

  • As the value of the Stapling property of a PrintTicket, the value instructs the printer whether, and where, to staple.

The Unknown value is never used in properties of PrintCapabilities objects.

You should never set a PrintTicket property to Unknown. If some other PrintTicket producing application has created a PrintTicket document that sets the stapling feature to an unrecognized option (that is, an option that is not defined in the Print Schema), then a PrintTicket object in your application that is constructed with that document will have Unknown as the value of the Stapling property.

Although the PrintTicket and PrintCapabilities classes cannot be inherited, you can extend the Print Schema to recognize print device features that are not accounted for in the PrintTicket or PrintCapabilities classes. For more information see How to: Extend the Print Schema and Create New Print System Classes.

The following example shows how to test a printer's capabilities and configure the print job to take advantage of them.

// ---------------------- 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()

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft