PrintQueue.MergeAndValidatePrintTicket 메서드

정의

PrintTicket을 병합한 후 그 결과로 얻게 되는 PrintTicket이 유효하고 프린터가 지원하지 않는 인쇄 기능을 요청하지 않도록 보장합니다.

오버로드

MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

PrintTicket을 병합한 후 그 결과로 얻게 되는 PrintTicket이 유효하고 프린터가 지원하지 않는 인쇄 기능을 요청하지 않도록 보장합니다.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

PrintTicket을 병합한 후 그 결과로 얻게 되는 PrintTicket이 유효하고 프린터가 지원하지 않는 인쇄 기능을 요청하지 않으며 지정된 범위로 제한되도록 보장합니다.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

PrintTicket을 병합한 후 그 결과로 얻게 되는 PrintTicket이 유효하고 프린터가 지원하지 않는 인쇄 기능을 요청하지 않도록 보장합니다.

public:
 System::Printing::ValidationResult MergeAndValidatePrintTicket(System::Printing::PrintTicket ^ basePrintTicket, System::Printing::PrintTicket ^ deltaPrintTicket);
public System.Printing.ValidationResult MergeAndValidatePrintTicket (System.Printing.PrintTicket basePrintTicket, System.Printing.PrintTicket deltaPrintTicket);
member this.MergeAndValidatePrintTicket : System.Printing.PrintTicket * System.Printing.PrintTicket -> System.Printing.ValidationResult
Public Function MergeAndValidatePrintTicket (basePrintTicket As PrintTicket, deltaPrintTicket As PrintTicket) As ValidationResult

매개 변수

basePrintTicket
PrintTicket

첫 번째 인쇄 티켓입니다.

deltaPrintTicket
PrintTicket

두 번째 인쇄 티켓입니다. 이 매개 변수는 null이 될 수 있습니다.

반환

병합된 ValidationResult을 포함하고 실행 가능성을 보장하기 위해 해당 설정 중 변경해야 하는 설정이 있는지 여부를 나타내는 PrintTicket입니다.

예외

입력 인쇄 티켓 중 적어도 하나가 유효하지 않은 경우

basePrintTicketnull인 경우

유효성 검사, 병합기 및 실행 가능성 확인 작업이 실패한 경우

예제

다음 예제에서는 이 메서드를 사용하여 두 개의 인쇄 티켓을 병합하고 반환되는 에 응답하는 ValidationResult 방법을 보여 드립니다.

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

설명

메서드는 실행 가능한 인쇄 티켓을 생성합니다. 즉, 프린터에서 지원하지 않는 인쇄 기능을 요청하지 않는 티켓입니다. 메서드는 먼저 인쇄 스키마에 대해 두 입력 인쇄 티켓의 유효성을 검사합니다. 둘 중 하나가 유효하지 않으면 예외가 throw됩니다.

그런 다음 두 티켓이 병합됩니다. 특정 속성에 대한 값이 다른 경우 결과 병합된 티켓은 처음에 델타 티켓의 값을 사용합니다.

그런 다음 병합된 티켓이 프린터의 실제 기능에 대해 확인됩니다. 티켓의 설정이 프린터의 기능과 호환되지 않는 경우 프린터 드라이버는 원하는 논리를 사용하여 해당 설정을 변경합니다. 일반적으로 설정에 대한 사용자 또는 프린터의 기본값을 대체합니다. 드라이버의 대체 값 원본이 와 동일한 티켓 basePrintTicket이 아닌 경우 병합된 티켓에는 두 입력 티켓 모두와 다른 일부 설정이 있을 수 있습니다. 프린터 드라이버가 설정을 변경해야 하는 경우 이 사실은 의 ValidationResult속성에 ConflictStatus 보고됩니다.

인쇄 큐의 기본 설정에 따라 병합하고 유효성을 검사하려면 를 또는 UserPrintTicketDefaultPrintTicket 설정 basePrintTicket 해야 합니다.

매개 변수는 deltaPrintTicket 일 수 있습니다 null. 이 경우 는 유효성을 basePrintTicket 검사하고, 실행 가능성을 확인하고, 변경 내용이 있는 상태로 반환됩니다.

이 오버로드를 MergeAndValidatePrintTicket사용하면 반환되는 의 및 PrintTicketValidationResult 에 모두 deltaPrintTicket 작업 전체 scope 있습니다. 다른 scope 지정하려면 이 메서드의 다른 오버로드를 사용합니다.

적용 대상

MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

PrintTicket을 병합한 후 그 결과로 얻게 되는 PrintTicket이 유효하고 프린터가 지원하지 않는 인쇄 기능을 요청하지 않으며 지정된 범위로 제한되도록 보장합니다.

public:
 System::Printing::ValidationResult MergeAndValidatePrintTicket(System::Printing::PrintTicket ^ basePrintTicket, System::Printing::PrintTicket ^ deltaPrintTicket, System::Printing::PrintTicketScope scope);
public System.Printing.ValidationResult MergeAndValidatePrintTicket (System.Printing.PrintTicket basePrintTicket, System.Printing.PrintTicket deltaPrintTicket, System.Printing.PrintTicketScope scope);
member this.MergeAndValidatePrintTicket : System.Printing.PrintTicket * System.Printing.PrintTicket * System.Printing.PrintTicketScope -> System.Printing.ValidationResult
Public Function MergeAndValidatePrintTicket (basePrintTicket As PrintTicket, deltaPrintTicket As PrintTicket, scope As PrintTicketScope) As ValidationResult

매개 변수

basePrintTicket
PrintTicket

첫 번째 인쇄 티켓입니다.

deltaPrintTicket
PrintTicket

두 번째 인쇄 티켓입니다. 이 매개 변수는 null이 될 수 있습니다.

scope
PrintTicketScope

deltaPrintTicket의 범위와 ValidationResult에서 반환된 인쇄 티켓의 범위가 페이지인지, 문서인지, 전체 작업인지 나타내는 값입니다.

반환

병합된 ValidationResult을 포함하고 실행 가능성을 보장하기 위해 해당 설정 중 변경해야 하는 설정이 있는지 여부를 나타내는 PrintTicket입니다.

예외

입력 인쇄 티켓 중 적어도 하나가 유효하지 않은 경우

basePrintTicketnull인 경우

scope 매개 변수에 유효한 PrintTicketScope 값이 없는 경우

유효성 검사, 병합기 및 실행 가능성 확인 작업이 실패한 경우

설명

메서드는 실행 가능한 인쇄 티켓을 생성합니다. 즉, 프린터에서 지원하지 않는 인쇄 기능을 요청하지 않는 티켓입니다. 메서드는 먼저 인쇄 스키마에 대해 두 입력 인쇄 티켓의 유효성을 검사합니다. 둘 중 하나가 유효하지 않으면 예외가 throw됩니다.

그런 다음 두 티켓이 병합됩니다. 특정 속성에 대한 값이 다른 경우 결과 병합된 티켓은 처음에 델타 티켓의 값을 사용합니다.

그런 다음 병합된 티켓이 프린터의 실제 기능에 대해 확인됩니다. 티켓의 설정이 프린터의 기능과 호환되지 않는 경우 프린터 드라이버는 원하는 논리를 사용하여 해당 설정을 변경합니다. 일반적으로 설정에 대한 사용자 또는 프린터의 기본값을 대체합니다. 드라이버의 대체 값 원본이 와 동일한 티켓 basePrintTicket이 아닌 경우 병합된 티켓에는 두 입력 티켓 모두와 다른 일부 설정이 있을 수 있습니다. 프린터 드라이버가 설정을 변경해야 하는 경우 이 사실은 의 ValidationResult속성에 ConflictStatus 보고됩니다.

인쇄 큐의 기본 설정에 따라 병합하고 유효성을 검사하려면 를 또는 UserPrintTicketDefaultPrintTicket 설정 basePrintTicket 해야 합니다.

매개 변수는 deltaPrintTicket 일 수 있습니다 null. 이 경우 는 유효성을 basePrintTicket 검사하고, 실행 가능성을 확인하고, 변경 내용이 있는 상태로 반환됩니다.

scope 작업인 경우 에서 ValidationResult 반환된 인쇄 티켓에는 작업, 문서 및 페이지 접두사를 사용하는 인쇄 스키마 매개 변수가 포함될 수 있습니다. 이 scope 문서인 경우 의 작업별 설정 deltaPrintTicket 은 무시되고 반환된 티켓에는 문서 및 페이지 접두사를 사용하는 매개 변수가 포함될 수 있습니다. 이 scope 페이지인 경우 의 작업별 설정 및 문서별 설정 deltaPrintTicket 이 무시되고 반환된 티켓에는 페이지 접두사만 있는 매개 변수가 포함될 수 있습니다.

적용 대상