Bagikan melalui


Stapling Enum

Definisi

Menentukan apakah, dan di mana, printer mengolah dokumen multi-halaman.

public enum class Stapling
public enum Stapling
type Stapling = 
Public Enum Stapling
Warisan
Stapling

Bidang

None 10

Dokumen tidak di-stapl.

SaddleStitch 1

Beberapa staples di sepanjang garis lipatan. Juga disebut pengaitan saddle-stitch.

StapleBottomLeft 2

Satu staple di sudut kiri bawah.

StapleBottomRight 3

Satu staple di sudut kanan bawah.

StapleDualBottom 7

Dua staples di sepanjang tepi bawah.

StapleDualLeft 4

Dua staples di sepanjang tepi kiri.

StapleDualRight 5

Dua staples di sepanjang tepi kanan.

StapleDualTop 6

Dua staples di sepanjang tepi atas.

StapleTopLeft 8

Satu staple di sudut kiri atas.

StapleTopRight 9

Satu staple di sudut kanan atas.

Unknown 0

Fitur (yang opsinya diwakili oleh enumerasi ini) diatur ke opsi yang tidak ditentukan dalam Skema Cetak.

Contoh

Contoh berikut menunjukkan cara menguji kemampuan printer dan mengonfigurasi pekerjaan cetak untuk memanfaatkannya.

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

Keterangan

Gunakan nilai jenis ini terutama untuk tujuan ini:

  • Sebagai anggota StaplingCapability koleksi, yang merupakan properti dari PrintCapabilities, nilai-nilai ini menunjukkan jenis pengaitan yang didukung printer.

  • Sebagai nilai Stapling properti dari , PrintTicketnilai menginstruksikan printer apakah, dan di mana, untuk staple.

Nilai Unknown tidak pernah digunakan dalam properti PrintCapabilities objek.

Anda tidak boleh mengatur PrintTicket properti ke Unknown. Jika beberapa aplikasi produksi lainnya PrintTicket telah membuat dokumen PrintTicket yang mengatur fitur pengaitan ke opsi yang tidak dikenal (yaitu, opsi yang tidak ditentukan dalam Skema Cetak), maka PrintTicket objek dalam aplikasi Anda yang dibangun dengan dokumen tersebut Stapling akan memiliki Unknown sebagai nilai properti .

PrintTicket Meskipun kelas dan PrintCapabilities tidak dapat diwariskan, Anda dapat memperluas Skema Cetak untuk mengenali fitur perangkat cetak yang tidak diperkirakan di PrintTicket kelas atau PrintCapabilities . Untuk informasi selengkapnya, lihat Cara: Memperluas Skema Cetak dan Membuat Kelas Sistem Cetak Baru.

Berlaku untuk

Lihat juga