PrintQueue.GetPrintCapabilities 메서드

정의

PrintCapabilities 프린터나 디바이스의 기능을 식별하는 개체(예: 컬러로 인쇄되는지 양면 인쇄 가능 여부)를 가져옵니다.

오버로드

Name Description
GetPrintCapabilities()

프린터의 PrintCapabilities 기능을 식별하는 개체를 가져옵니다.

GetPrintCapabilities(PrintTicket)

프린터의 PrintCapabilities 기능을 식별하는 개체를 가져옵니다.

GetPrintCapabilities()

프린터의 PrintCapabilities 기능을 식별하는 개체를 가져옵니다.

public:
 System::Printing::PrintCapabilities ^ GetPrintCapabilities();
public System.Printing.PrintCapabilities GetPrintCapabilities();
member this.GetPrintCapabilities : unit -> System.Printing.PrintCapabilities
Public Function GetPrintCapabilities () As PrintCapabilities

반품

PrintCapabilities 양면 대처 또는 자동 스테이플링과 같이 프린터에서 수행할 수 있는 작업과 수행할 수 없는 작업을 지정하는 개체입니다.

예외

개체를 PrintCapabilities 검색할 수 없습니다.

예제

다음 예제에서는 두 개의 인쇄 티켓을 병합하는 동안 이 메서드를 사용하는 방법을 보여 주었습니다.

/// <summary>
/// Changes the user-default PrintTicket setting of the specified print queue.
/// </summary>
/// <param name="queue">the printer whose user-default PrintTicket setting needs to be changed</param>
static private void ChangePrintTicketSetting(PrintQueue queue)
{
    //
    // Obtain the printer's PrintCapabilities so we can determine whether or not
    // duplexing printing is supported by the printer.
    //
    PrintCapabilities printcap = queue.GetPrintCapabilities();

    //
    // The printer's duplexing capability is returned as a read-only collection of duplexing options
    // that can be supported by the printer. If the collection returned contains the duplexing
    // option we want to set, it means the duplexing option we want to set is supported by the printer,
    // so we can make the user-default PrintTicket setting change.
    //
    if (printcap.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge))
    {
        //
        // To change the user-default PrintTicket, we can first create a delta PrintTicket with
        // the new duplexing setting.
        //
        PrintTicket deltaTicket = new PrintTicket();
        deltaTicket.Duplexing = Duplexing.TwoSidedLongEdge;

        //
        // Then merge the delta PrintTicket onto the printer's current user-default PrintTicket,
        // and validate the merged PrintTicket to get the new PrintTicket we want to set as the
        // printer's new user-default PrintTicket.
        //
        ValidationResult result = queue.MergeAndValidatePrintTicket(queue.UserPrintTicket, deltaTicket);

        //
        // The duplexing option we want to set could be constrained by other PrintTicket settings
        // or device settings. We can check the validated merged PrintTicket to see whether the
        // the validation process has kept the duplexing option we want to set unchanged.
        //
        if (result.ValidatedPrintTicket.Duplexing == Duplexing.TwoSidedLongEdge)
        {
            //
            // Set the printer's user-default PrintTicket and commit the set operation.
            //
            queue.UserPrintTicket = result.ValidatedPrintTicket;
            queue.Commit();
            Console.WriteLine("PrintTicket new duplexing setting is set on '{0}'.", queue.FullName);
        }
        else
        {
            //
            // The duplexing option we want to set has been changed by the validation process
            // when it was resolving setting constraints.
            //
            Console.WriteLine("PrintTicket new duplexing setting is constrained on '{0}'.", queue.FullName);
        }
    }
    else
    {
        //
        // If the printer doesn't support the duplexing option we want to set, skip it.
        //
        Console.WriteLine("PrintTicket new duplexing setting is not supported on '{0}'.", queue.FullName);
    }
}
''' <summary>
''' Changes the user-default PrintTicket setting of the specified print queue.
''' </summary>
''' <param name="queue">the printer whose user-default PrintTicket setting needs to be changed</param>
Private Shared Sub ChangePrintTicketSetting(ByVal queue As PrintQueue)
    '
    ' Obtain the printer's PrintCapabilities so we can determine whether or not
    ' duplexing printing is supported by the printer.
    '
    Dim printcap As PrintCapabilities = queue.GetPrintCapabilities()

    '
    ' The printer's duplexing capability is returned as a read-only collection of duplexing options
    ' that can be supported by the printer. If the collection returned contains the duplexing
    ' option we want to set, it means the duplexing option we want to set is supported by the printer,
    ' so we can make the user-default PrintTicket setting change.
    '
    If printcap.DuplexingCapability.Contains(Duplexing.TwoSidedLongEdge) Then
        '
        ' To change the user-default PrintTicket, we can first create a delta PrintTicket with
        ' the new duplexing setting.
        '
        Dim deltaTicket As New PrintTicket()
        deltaTicket.Duplexing = Duplexing.TwoSidedLongEdge

        '
        ' Then merge the delta PrintTicket onto the printer's current user-default PrintTicket,
        ' and validate the merged PrintTicket to get the new PrintTicket we want to set as the
        ' printer's new user-default PrintTicket.
        '
        Dim result As ValidationResult = queue.MergeAndValidatePrintTicket(queue.UserPrintTicket, deltaTicket)

        '
        ' The duplexing option we want to set could be constrained by other PrintTicket settings
        ' or device settings. We can check the validated merged PrintTicket to see whether the
        ' the validation process has kept the duplexing option we want to set unchanged.
        '
        If result.ValidatedPrintTicket.Duplexing = Duplexing.TwoSidedLongEdge Then
            '
            ' Set the printer's user-default PrintTicket and commit the set operation.
            '
            queue.UserPrintTicket = result.ValidatedPrintTicket
            queue.Commit()
            Console.WriteLine("PrintTicket new duplexing setting is set on '{0}'.", queue.FullName)
        Else
            '
            ' The duplexing option we want to set has been changed by the validation process
            ' when it was resolving setting constraints.
            '
            Console.WriteLine("PrintTicket new duplexing setting is constrained on '{0}'.", queue.FullName)
        End If
    Else
        '
        ' If the printer doesn't support the duplexing option we want to set, skip it.
        '
        Console.WriteLine("PrintTicket new duplexing setting is not supported on '{0}'.", queue.FullName)
    End If
End Sub

적용 대상

GetPrintCapabilities(PrintTicket)

프린터의 PrintCapabilities 기능을 식별하는 개체를 가져옵니다.

public:
 System::Printing::PrintCapabilities ^ GetPrintCapabilities(System::Printing::PrintTicket ^ printTicket);
[System.Security.SecurityCritical]
public System.Printing.PrintCapabilities GetPrintCapabilities(System.Printing.PrintTicket printTicket);
public System.Printing.PrintCapabilities GetPrintCapabilities(System.Printing.PrintTicket printTicket);
[<System.Security.SecurityCritical>]
member this.GetPrintCapabilities : System.Printing.PrintTicket -> System.Printing.PrintCapabilities
member this.GetPrintCapabilities : System.Printing.PrintTicket -> System.Printing.PrintCapabilities
Public Function GetPrintCapabilities (printTicket As PrintTicket) As PrintCapabilities

매개 변수

printTicket
PrintTicket

인쇄 기능이 보고되는 기초를 제공하는 인쇄 티켓입니다.

반품

PrintCapabilities 양면 대처 또는 자동 스테이플링과 같이 프린터에서 수행할 수 있는 작업과 수행할 수 없는 작업을 지정하는 개체입니다.

특성

예외

개체를 PrintCapabilities 검색할 수 없습니다.

printTicket 형식이 잘못되었습니다.

설명

매개 PrintTicket 변수는 개체를 생성 PrintCapabilities 할 기준으로 사용됩니다. 예를 들어 프린터는 입력 빈 1에서 미디어 형식 A와 B만 지원 하 고 입력 빈 2에서 미디어 형식 C만 지원 하는 경우를 가정 합니다. 매개 변수가 printTicket 입력 bin 1 PrintCapabilities 을 지정한 경우 반환되는 개체에는 세 가지 미디어 형식이 모두 포함되지만 C 형식은 "제한됨"으로 보고됩니다. 매개 변수가 printTicket 입력 bin 2 PrintCapabilities 를 지정한 경우 반환되는 개체에는 세 가지 미디어 형식이 모두 포함되지만 A 및 B 형식은 "제한됨"으로 보고됩니다. 제약 조건에 대한 자세한 내용은 인쇄 스키마 를 참조하세요.

printTicketnull 경우 UserPrintTicket 사용됩니다.

적용 대상