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

Window 信封。

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 应用程序中使用该文档构造的对象将具有 未知 作为 属性的值 PageMediaType

PrintTicket尽管 无法继承 和 PrintCapabilities 类,但可以扩展打印架构,以识别 在 或 PrintCapabilities 类中PageMediaType未考虑的打印设备功能。 有关详细信息,请参阅 如何:扩展打印架构和创建新的打印系统类

适用于

另请参阅