InputBin 列舉

定義

指定做為空白紙張或其他列印媒體來源的輸入紙匣。Specifies the input bin that is used as the source of blank paper or other print media.

public enum class InputBin
public enum InputBin
type InputBin = 
Public Enum InputBin
繼承
InputBin

欄位

AutoSelect 1

根據紙張大小和媒體輸出類型自動選取輸入紙匣。The automatic selection of an input bin according to the page size and media output type.

AutoSheetFeeder 4

使用自動送紙器。The automatic sheet feeder is used.

Cassette 2

使用抽取式紙匣。A removable paper bin is used.

Manual 5

使用手動輸入紙匣。The manual input bin is used.

Tractor 3

使用可連續送紙的曳引送紙 (也稱為孔式送紙)。A tractor feed (also called a pin feed) of continuous-feed paper is used.

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 determine printer 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()

備註

此類型的值主要用於下列用途:The values of this type are used primarily for these purposes:

值永遠不會用於物件的PrintCapabilities屬性中。 UnknownThe Unknown value is never used in properties of PrintCapabilities objects.

您絕對不應該將PrintTicket屬性設定Unknown為。You should never set a PrintTicket property to Unknown. 如果某些其他PrintTicket產生的應用程式已PrintTicket建立檔, 將輸入 bin 功能設定為無法辨識的 optio (也就是在列印架構中未定義的選項, 則PrintTicket為您的使用該檔所建立的應用程式將Unknown具有做為InputBin屬性的值。If some other PrintTicket producing application has created a PrintTicket document that sets the input bin feature to an unrecognized optio, (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 InputBin property.

PrintCapabilities PrintTicket 雖然無法繼承PrintCapabilities和類別, 但是您可以擴充列印架構, 以辨識或類別中未納入的列印裝置功能。 PrintTicketAlthough 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.

適用於

另請參閱