PagesPerSheetDirection 枚举

定义

指定在打印介质单面上显示多页内容时的页面排列。Specifies the arrangement of pages when more than one page of content appears on a single side of print media.

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

字段

BottomLeft 4

页面以从上到下从右至左(相对于页面方向)的列方式显示。Pages appear in columns, from top to bottom and right to left relative to page orientation.

BottomRight 2

页面以从上到下从左至右(相对于页面方向)的列方式显示。Pages appear in columns, from top to bottom and left to right relative to page orientation.

LeftBottom 3

页面以从右至左从上到下(相对于页面方向)的行方式显示。Pages appear in rows, from right to left and top to bottom relative to page orientation.

LeftTop 7

页面以从右至左从下到上(相对于页面方向)的行方式显示。Pages appear in rows, from right to left and bottom to top relative to page orientation.

RightBottom 1

页面以从左至右从上到下(相对于页面方向)的行方式显示。Pages appear in rows, from left to right and top to bottom relative to page orientation.

RightTop 5

页面以从左至右从下到上(相对于页面方向)的行方式显示。Pages appear in rows, from left to right and bottom to top relative to page orientation.

TopLeft 8

页面以从下到上从右至左(相对于页面方向)的列方式显示。Pages appear in columns, from bottom to top and right to left relative to page orientation.

TopRight 6

页面以从下到上从左至右(相对于页面方向)的列方式显示。Pages appear in columns, from bottom to top and left to right relative to page orientation.

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:

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使用该文档构造的应用程序中的对象将作为该PagesPerSheetDirection属性的值未知。If some other PrintTicket producing application has created a PrintTicket document that sets the pages-per-sheet-direction 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 PagesPerSheetDirection 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.

适用于

另请参阅