PageMediaType 枚举

定义

指定打印纸张或其他介质的类型。Specifies types of printing paper or other media.

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

字段

Archival 2

存档质量介质。Archive-quality media.

AutoSelect 1

打印设备选择介质。The print device selects the media.

BackPrintFilm 3

专业背面打印胶片。Specialty back-printing film.

Bond 4

标准铜版纸介质。Standard bond media.

CardStock 5

标准卡片纸。Standard card stock.

Continuous 6

持续送纸介质。Continuous-feed media.

EnvelopePlain 7

标准信封。Standard envelope.

EnvelopeWindow 8

Window 信封。Window envelope.

Fabric 9

纤维介质。Fabric media.

HighResolution 10

专业高分辨率介质。Specialty high-resolution media.

Label 11

标签介质。Label media.

MultiLayerForm 12

附加的多部分窗体。Attached multipart forms.

MultiPartForm 13

单个多部分窗体。Individual multipart forms.

None 29

未知或未列出的介质。Unknown or unlisted media.

Photographic 14

标准照片介质。Standard photographic media.

PhotographicFilm 15

胶片照片介质。Film photographic media.

PhotographicGlossy 16

光面照片介质。Glossy photographic media.

PhotographicHighGloss 17

高光照片介质。High-gloss photographic media.

PhotographicMatte 18

亚光照片介质。Matte photographic media.

PhotographicSatin 19

缎纹照片介质。Satin photographic media.

PhotographicSemiGloss 20

半光照片介质。Semi-gloss photographic media.

Plain 21

普通纸。Plain paper.

Screen 22

以连续窗体显示输出。Output to a display in continuous form.

ScreenPaged 23

以分页窗体显示输出。Output to a display in paged form.

Stationery 24

专业静止。Specialty stationary.

TabStockFull 25

槽片,未预制(单片)。Tab stock, not precut (single tabs).

TabStockPreCut 26

槽片,预制(多片)。Tab stock, precut (multiple tabs).

Transparency 27

透明纸。Transparent sheet.

TShirtTransfer 28

用于将图像转印到 T 恤衫的介质。Media that is used to transfer an image to a T-shirt.

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 the 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:

Unknownvalue 从不用于对象的PrintCapabilities属性。The Unknownvalue is never used in properties of PrintCapabilities objects.

永远不应将PrintTicket属性设置为 "未知"。You should never set a PrintTicket property to Unknown. 如果生成应用PrintTicket程序的其他部分创建了一个 PrintTicket 文档, 该文档将页面媒体类型功能设置为无法识别的选项 (即, 未在打印架构中定义的选项PrintTicket ), 则使用该文档构造的应用程序将作为该PageMediaType属性的值未知。If some other PrintTicket producing application has created a PrintTicket document that sets the page media type feature to an unrecognized option (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 PageMediaType property.

PageMediaType PrintCapabilities尽管和PrintTicket PrintCapabilities类不能被继承, 但你可以扩展打印架构来识别在或类中不考虑的打印设备功能。Although 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 PageMediaType or PrintCapabilities classes. 有关详细信息,请参阅如何:扩展打印架构并创建新的打印系统类For more information, see How to: Extend the Print Schema and Create New Print System Classes.

适用于

另请参阅