Stapling 枚举

定义

指定打印机是否装订多页文档,并在什么位置装订。Specifies whether, and where, a printer staples a multi-page document.

public enum class Stapling
public enum Stapling
type Stapling = 
Public Enum Stapling
继承
Stapling

字段

None 10

未装订文档。The document is not stapled.

SaddleStitch 1

沿着折线进行多次装订,Multiple staples along the fold line. 也称为骑马订。Also called saddle-stitch stapling.

StapleBottomLeft 2

在左下角进行单次装订。A single staple in the lower-left corner.

StapleBottomRight 3

在右下角进行单次装订。A single staple in the lower-right corner.

StapleDualBottom 7

沿着下边缘进行两次装订。Two staples along the lower edge.

StapleDualLeft 4

沿着左边缘进行两次装订。Two staples along the left edge.

StapleDualRight 5

沿着右边缘进行两次装订。Two staples along the right edge.

StapleDualTop 6

沿着上边缘进行两次装订。Two staples along the upper edge.

StapleTopLeft 8

在左上角进行单次装订。A single staple in the upper-left corner.

StapleTopRight 9

在右上角进行单次装订。A single staple in the upper-right corner.

Unknown 0

该功能(其选项由此枚举表示)设置为未在打印架构中定义的选项。The feature (whose options are represented by this enumeration) is set to an option not defined in the Print Schema.

示例

下面的示例演示如何测试打印机的功能, 以及如何配置打印作业以利用这些功能。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>
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()
// ---------------------- 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()
' ---------------------- GetPrintTicketFromPrinter -----------------------
''' <summary>
'''   Returns a PrintTicket based on the current default printer.</summary>
''' <returns>
'''   A PrintTicket for the current local default printer.</returns>
Private Function GetPrintTicketFromPrinter() As PrintTicket
    Dim printQueue As PrintQueue = Nothing

    Dim localPrintServer As New LocalPrintServer()

    ' Retrieving collection of local printer on user machine
    Dim localPrinterCollection As PrintQueueCollection = localPrintServer.GetPrintQueues()

    Dim localPrinterEnumerator As System.Collections.IEnumerator = localPrinterCollection.GetEnumerator()

    If localPrinterEnumerator.MoveNext() Then
        ' Get PrintQueue from first available printer
        printQueue = CType(localPrinterEnumerator.Current, PrintQueue)
    Else
        ' No printer exist, return null PrintTicket
        Return Nothing
    End If

    ' Get default PrintTicket from printer
    Dim printTicket As PrintTicket = printQueue.DefaultPrintTicket

    Dim printCapabilites As PrintCapabilities = printQueue.GetPrintCapabilities()

    ' Modify PrintTicket
    If printCapabilites.CollationCapability.Contains(Collation.Collated) Then
        printTicket.Collation = Collation.Collated
    End If

    If printCapabilites.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge) Then
        printTicket.Duplexing = Duplexing.TwoSidedLongEdge
    End If

    If printCapabilites.StaplingCapability.Contains(Stapling.StapleDualLeft) Then
        printTicket.Stapling = Stapling.StapleDualLeft
    End If

    Return printTicket
End Function ' end:GetPrintTicketFromPrinter()

注解

使用此类型的值主要用于以下目的:Use the values of this type primarily for these purposes:

Unknown值从不用于对象的PrintCapabilities属性。The Unknown value is never used in properties of PrintCapabilities objects.

永远不应将PrintTicket属性设置为。 UnknownYou should never set a PrintTicket property to Unknown. 如果生成应用PrintTicket程序的其他部分创建了一个PrintTicket 文档, 该文档将装订功能设置为无法识别的选项 (即, 未在PrintTicket 打印架构中定义的选项), 则使用该文档构造的应用程序将具有Unknown Stapling属性的值。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.

PrintTicket PrintCapabilities尽管和PrintTicket PrintCapabilities类不能被继承, 但你可以扩展打印架构来识别在或类中不考虑的打印设备功能。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.

适用于

另请参阅