PrintTicket::Stapling Property
Gets or sets a value indicating whether, and where, a printer staples multiple pages.
Assembly: ReachFramework (in ReachFramework.dll)
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | Calling code has attempted to set the property to a value that is not in the Stapling enumeration. |
For example, a printer can place two staples on the left edge of a sheet of paper, or one staple in the upper left corner.
A nullptr value for this property means that this feature setting is not specified. Also, when the value is nullptr, 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 JobStapleAllDocuments keyword, not the DocumentStaple keyword.
You can test for the options that the printer supports by using the StaplingCapability 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.
// ---------------------- GetPrintTicketFromPrinter ----------------------- /// <summary> /// Returns a PrintTicket based on the current default printer.</summary> /// <returns> /// A PrintTicket for the current local default printer.</returns> PrintTicket^ GetPrintTicketFromPrinter () { PrintQueue^ printQueue = nullptr; LocalPrintServer^ localPrintServer = gcnew 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 { return nullptr; } // 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()
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.