Collation Collation Collation Collation Enum

定义

指定打印机在打印多页打印作业的多个副本时是否逐份打印输出。Specifies whether a printer collates output when it prints multiple copies of a multi-page print job.

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

字段

Collated Collated Collated Collated 1

逐份打印输出。Collated output.

Uncollated Uncollated Uncollated Uncollated 2

不逐份打印输出。Uncollated output.

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

注解

标准打印机通常逐份打印输出通过打印每个页上的第一个副本,然后第二个副本和等等的每一页。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.

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

  • 作为的成员CollationCapability回收,这是一个属性的PrintCapabilities,这些值表示打印机支持的输出的类型。As members of the CollationCapability collection, which is a property of PrintCapabilities, these values indicate the type of output that the printer supports. (许多打印机都支持这两种类型)。(Many printers support both types.)

  • 值作为Collation属性的PrintTicket,该值指示打印机是否逐份打印。As the value of the Collation property of a PrintTicket, the value instructs the printer whether to collate.

未知属性中永远不会使用值PrintCapabilities对象。The Unknown value is never used in properties of PrintCapabilities objects.

绝不应设置PrintTicket属性设置为未知You should never set a PrintTicket property to Unknown. 如果某一其他PrintTicket生成应用程序已创建PrintTicket 文档排序规则功能设置为一个无法识别排序规则选项,则PrintTicket构造与在应用程序中的对象该文档将具有未知的值作为Collation属性。If some other PrintTicket producing application has created a PrintTicket document that sets the collation feature to an unrecognized collation option, then a PrintTicket object in your application that is constructed with that document will have Unknown as the value of the Collation property.

尽管PrintTicketPrintCapabilities类不能被继承,可以扩展打印架构识别并不表示中的打印设备功能PrintTicketPrintCapabilities类。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.

适用于

另请参阅