Stapling 列舉
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
指定印表機是否裝訂多頁文件以及裝訂位置。
public enum class Stapling
public enum Stapling
type Stapling =
Public Enum Stapling
- 繼承
欄位
None | 10 | 文件未裝訂。 |
SaddleStitch | 1 | 沿著摺疊線裝訂多個訂書針。 亦稱為騎馬訂裝訂。 |
StapleBottomLeft | 2 | 在左下角裝訂一個訂書針。 |
StapleBottomRight | 3 | 在右下角裝訂一個訂書針。 |
StapleDualBottom | 7 | 在下邊緣裝訂兩個訂書針。 |
StapleDualLeft | 4 | 在左邊緣裝訂兩個訂書針。 |
StapleDualRight | 5 | 在右邊緣裝訂兩個訂書針。 |
StapleDualTop | 6 | 在上邊緣裝訂兩個訂書針。 |
StapleTopLeft | 8 | 在左上角裝訂一個訂書針。 |
StapleTopRight | 9 | 在右上角裝訂一個訂書針。 |
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()
備註
針對下列用途,請使用此類型的值:
做為 集合的成員 StaplingCapability ,這是的屬性 PrintCapabilities,這些值表示列印機支援的裝訂類型。
做為 的 StaplingPrintTicket屬性值,這個值會指示印表機是否要裝訂,以及要裝訂的位置。
值 Unknown
永遠不會用在 對象的屬性 PrintCapabilities 中。
您絕對不應該將 PrintTicket 屬性設定為 Unknown
。 如果某些其他 PrintTicket 產生應用程式已建立 PrintTicket 檔案 ,將裝訂功能設定為無法辨識的選項 (,則未在 列印架構) 中定義的選項,則 PrintTicket 以該檔建構的應用程式中的物件將具有 Unknown
做為 屬性的值 Stapling 。
PrintTicket雖然 無法繼承 和 PrintCapabilities 類別,但您可以擴充列印架構,以辨識未在 或 PrintCapabilities 類別中考慮的PrintTicket列印裝置功能。 如需詳細資訊,請參閱 如何:擴充列印架構和建立新的列印系統類別。