แก้ไข

แชร์ผ่าน


PageMediaType Enum

Definition

Specifies types of printing paper or other media.

public enum class PageMediaType
public enum PageMediaType
type PageMediaType = 
Public Enum PageMediaType
Inheritance
PageMediaType

Fields

Name Value Description
Unknown 0

The feature (whose options are represented by this enumeration) is set to an option not defined in the Print Schema.

AutoSelect 1

The print device selects the media.

Archival 2

Archive-quality 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 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.

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

Media that is used to transfer an image to a T-shirt.

None 29

Unknown or unlisted media.

Examples

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

Remarks

The values of this type are used primarily for these purposes:

The Unknownvalue is never used in properties of PrintCapabilities objects.

You should never set a PrintTicket property to Unknown. 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.

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.

Applies to

See also