PageOrder 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定打印设备是从前往后还是从后往前打印多页文档。
public enum class PageOrder
public enum PageOrder
type PageOrder =
Public Enum PageOrder
- 继承
字段
Reverse | 2 | 以从后往前的顺序输出打印。 |
Standard | 1 | 以从前往后的顺序输出打印。 |
Unknown | 0 | 该功能(其选项由此枚举表示)设置为未在 打印架构中定义的选项。 |
示例
以下示例演示如何测试打印机的功能,以及如何配置打印作业以利用它们。
// ---------------------- 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^ printCapabilities = printQueue->GetPrintCapabilities();
// Modify PrintTicket
if (printCapabilities->CollationCapability->Contains(Collation::Collated))
{
printTicket->Collation = Collation::Collated;
}
if (printCapabilities->DuplexingCapability->Contains(Duplexing::TwoSidedLongEdge))
{
printTicket->Duplexing = Duplexing::TwoSidedLongEdge;
}
if (printCapabilities->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 printCapabilities = printQueue.GetPrintCapabilities();
// Modify PrintTicket
if (printCapabilities.CollationCapability.Contains(Collation.Collated))
{
printTicket.Collation = Collation.Collated;
}
if ( printCapabilities.DuplexingCapability.Contains(
Duplexing.TwoSidedLongEdge) )
{
printTicket.Duplexing = Duplexing.TwoSidedLongEdge;
}
if (printCapabilities.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 printCapabilities As PrintCapabilities = printQueue.GetPrintCapabilities()
' Modify PrintTicket
If printCapabilities.CollationCapability.Contains(Collation.Collated) Then
printTicket.Collation = Collation.Collated
End If
If printCapabilities.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge) Then
printTicket.Duplexing = Duplexing.TwoSidedLongEdge
End If
If printCapabilities.StaplingCapability.Contains(Stapling.StapleDualLeft) Then
printTicket.Stapling = Stapling.StapleDualLeft
End If
Return printTicket
End Function ' end:GetPrintTicketFromPrinter()
注解
使用此类型的值主要用于以下目的:
作为 集合的成员 PageOrderCapability (的 属性), PrintCapabilities这些值指示打印机支持的页顺序类型。 (许多打印机都支持这两种类型。)
作为 的 属性PrintTicket的值PageOrder,该值指示打印机按指定顺序打印输出。
未知值永远不会在 对象的属性PrintCapabilities中使用。
切勿将 PrintTicket 属性设置为 Unknown。 如果其他 PrintTicket 某个生成应用程序创建了一个 PrintTicket 文档 ,该文档将页面顺序功能设置为无法识别的选项 (即 打印架构) 中未定义的选项,则 PrintTicket 应用程序中使用该文档构造的对象将具有 未知 作为 属性的值 PageOrder 。
PrintTicket尽管 无法继承 和 PrintCapabilities 类,但可以扩展打印架构,以识别 在 或 PrintCapabilities 类中PrintTicket未考虑的打印设备功能。 有关详细信息,请参阅 如何:扩展打印架构和创建新的打印系统类。