PagesPerSheetDirection 枚举
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定在打印介质单面上显示多页内容时的页面排列。
public enum class PagesPerSheetDirection
public enum PagesPerSheetDirection
type PagesPerSheetDirection =
Public Enum PagesPerSheetDirection
- 继承
字段
BottomLeft | 4 | 页面以从上到下从右至左(相对于页面方向)的列方式显示。 |
BottomRight | 2 | 页面以从上到下从左至右(相对于页面方向)的列方式显示。 |
LeftBottom | 3 | 页面以从右至左从上到下(相对于页面方向)的行方式显示。 |
LeftTop | 7 | 页面以从右至左从下到上(相对于页面方向)的行方式显示。 |
RightBottom | 1 | 页面以从左至右从上到下(相对于页面方向)的行方式显示。 |
RightTop | 5 | 页面以从左至右从下到上(相对于页面方向)的行方式显示。 |
TopLeft | 8 | 页面以从下到上从右至左(相对于页面方向)的列方式显示。 |
TopRight | 6 | 页面以从下到上从左至右(相对于页面方向)的列方式显示。 |
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()
注解
使用此类型的值主要用于以下目的:
作为 集合的成员 PagesPerSheetDirectionCapability (它是 的 PrintCapabilities属性),这些值指示打印机支持的页面排列方式。
作为 的 属性PrintTicket的值PagesPerSheetDirection, 值指示打印机按指定方向排列内容页。
未知值永远不会在 对象的属性PrintCapabilities中使用。
切勿将 PrintTicket 属性设置为 Unknown。 如果其他 PrintTicket 一些生成应用程序创建了 PrintTicket 文档 ,该文档将每张页方向功能设置为无法识别的选项, (即打印 架构) 中未定义的选项,则 PrintTicket 应用程序中使用该文档构造的对象将具有 Unknown 作为 属性的值 PagesPerSheetDirection 。
PrintTicket尽管 无法继承 和 PrintCapabilities 类,但你可以扩展打印架构以识别 未在 或 PrintCapabilities 类中PrintTicket考虑的打印设备功能。 有关详细信息 ,请参阅如何:扩展打印架构和创建新的打印系统类。