共用方式為


PageMediaType 列舉

定義

指定列印紙張或其他媒體的型別。

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

欄位

Archival 2

封存品質媒體。

AutoSelect 1

列印裝置選擇媒體。

BackPrintFilm 3

特殊反面列印薄膜。

Bond 4

標準證券紙。

CardStock 5

標準卡片。

Continuous 6

連續式標籤紙。

EnvelopePlain 7

標準信封。

EnvelopeWindow 8

窗口信封。

Fabric 9

織物媒體。

HighResolution 10

特殊高解析度媒體。

Label 11

標籤紙。

MultiLayerForm 12

附加的複合型表單。

MultiPartForm 13

個別複合型表單。

None 29

未知或未列出的媒體。

Photographic 14

標準相片紙。

PhotographicFilm 15

底片媒體。

PhotographicGlossy 16

光面相片紙。

PhotographicHighGloss 17

高光亮相片紙。

PhotographicMatte 18

遮光紙。

PhotographicSatin 19

低光澤相片紙。

PhotographicSemiGloss 20

半光面相片紙。

Plain 21

普通紙。

Screen 22

以連續表單的顯示輸出。

ScreenPaged 23

以頁面表單的顯示輸出。

Stationery 24

特殊固定。

TabStockFull 25

標籤,非預裁大小 (單一標籤)。

TabStockPreCut 26

標籤,預裁大小 (多個標籤)。

Transparency 27

透明表單。

TShirtTransfer 28

用來印製圖像至 T 恤的媒體。

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

備註

此類型的值主要用於下列用途:

Unknownvalue 永遠不會用在 對象的屬性 PrintCapabilities 中。

您不應該將 PrintTicket 屬性設定為 Unknown。 如果有些其他 PrintTicket 產生應用程式已建立 PrintTicket 檔,將頁面媒體類型功能設定為無法辨識的選項 (,則列印 架構) 中未定義的選項,則 PrintTicket 應用程式中使用該檔建構的物件將會有 Unknown 做為 屬性的值 PageMediaType

PrintTicket雖然 無法繼承 和 PrintCapabilities 類別,但您可以擴充列印架構,以辨識未在 或 PrintCapabilities 類別中考慮的PageMediaType列印裝置功能。 如需詳細資訊,請參閱 如何:擴充列印架構和建立新的列印系統類別

適用於

另請參閱