PrintQueue.MergeAndValidatePrintTicket Metoda

Definicja

Scala dwa PrintTickets i gwarantuje, że wynik PrintTicket jest prawidłowy i nie prosi o żadne funkcje drukowania, które drukarka nie obsługuje.

Przeciążenia

MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

Scala dwa PrintTickets i gwarantuje, że wynik PrintTicket jest prawidłowy i nie prosi o żadne funkcje drukowania, które drukarka nie obsługuje.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

Scala dwa PrintTickets i gwarantuje, że wynik PrintTicket jest prawidłowy, nie prosi o żadne funkcje drukowania, których drukarka nie obsługuje i jest ograniczona do określonego zakresu.

MergeAndValidatePrintTicket(PrintTicket, PrintTicket)

Scala dwa PrintTickets i gwarantuje, że wynik PrintTicket jest prawidłowy i nie prosi o żadne funkcje drukowania, które drukarka nie obsługuje.

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

Parametry

basePrintTicket
PrintTicket

Pierwszy bilet wydruku.

deltaPrintTicket
PrintTicket

Drugi bilet wydruku. Może to być null.

Zwraca

Element ValidationResult , który obejmuje scalone PrintTicket i wskazanie, czy którykolwiek z jego ustawień musiał zostać zmieniony w celu zagwarantowania rentowności.

Wyjątki

Co najmniej jeden z biletów wydruku wejściowego jest nieprawidłowy.

Wartość basePrintTicket to null.

Operacja sprawdzania poprawności, fuzji i rentowności nie powiodła się.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą tej metody scalić dwa bilety drukowania i reagować na ValidationResult zwracane bilety.

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

Uwagi

Metoda generuje realny bilet wydruku; oznacza to, że bilet, który nie żąda funkcji drukowania, które drukarka nie obsługuje. Metoda najpierw weryfikuje dwa wejściowe bilety drukowania względem schematu wydruku. Jeśli którykolwiek z tych elementów jest nieprawidłowy, zgłaszany jest wyjątek.

Dwa bilety są następnie scalane. Jeśli mają różne wartości dla określonej właściwości, wynikowy scalony bilet początkowo używa wartości biletu różnicowego.

Scalony bilet jest następnie sprawdzany pod kątem rzeczywistych możliwości drukarki. Jeśli jakiekolwiek ustawienia w bilecie są niezgodne z możliwościami drukarki, sterownik drukarki zmienia te ustawienia przy użyciu dowolnej logiki. Zazwyczaj zastępuje domyślną wartość ustawienia użytkownika lub drukarki. Źródłem wartości zastępczych kierowcy nie jest ten sam bilet co basePrintTicket, a następnie scalony bilet może mieć pewne ustawienia, które różnią się od obu biletów wejściowych. Jeśli sterownik drukarki musi zmienić ustawienia, ten fakt jest zgłaszany we ConflictStatus właściwości .ValidationResult

Aby scalić i sprawdzić poprawność na podstawie domyślnych ustawień kolejki wydruku, należy ustawić wartość basePrintTicket lub DefaultPrintTicket .UserPrintTicket

Parametr deltaPrintTicket może mieć nullwartość , w którym przypadku basePrintTicket parametr jest weryfikowany, sprawdzany pod kątem rentowności i zwracany, prawdopodobnie ze zmianami.

W przypadku tego przeciążenia parametru MergeAndValidatePrintTicketzarówno , deltaPrintTicket jak i PrintTicket w zwracanym obiekcie ValidationResult mają szeroki zakres zadania. Aby określić inny zakres, użyj innego przeciążenia tej metody.

Dotyczy

MergeAndValidatePrintTicket(PrintTicket, PrintTicket, PrintTicketScope)

Scala dwa PrintTickets i gwarantuje, że wynik PrintTicket jest prawidłowy, nie prosi o żadne funkcje drukowania, których drukarka nie obsługuje i jest ograniczona do określonego zakresu.

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

Parametry

basePrintTicket
PrintTicket

Pierwszy bilet wydruku.

deltaPrintTicket
PrintTicket

Drugi bilet wydruku. Może to być null.

scope
PrintTicketScope

Wartość wskazująca, czy zakres i zakres deltaPrintTicketbiletu wydruku zwrócony w ValidationResultobiekcie to strona, dokument lub całe zadanie.

Zwraca

Element ValidationResult , który obejmuje scalone PrintTicket i wskazanie, czy którykolwiek z jego ustawień musiał zostać zmieniony w celu zagwarantowania rentowności.

Wyjątki

Co najmniej jeden z biletów wydruku wejściowego jest nieprawidłowy.

Wartość basePrintTicket to null.

Parametr scope nie ma prawidłowej PrintTicketScope wartości.

Operacja sprawdzania poprawności, fuzji i rentowności nie powiodła się.

Uwagi

Metoda generuje realny bilet wydruku; oznacza to, że bilet, który nie żąda funkcji drukowania, które drukarka nie obsługuje. Metoda najpierw weryfikuje dwa wejściowe bilety drukowania względem schematu wydruku. Jeśli którykolwiek z tych elementów jest nieprawidłowy, zgłaszany jest wyjątek.

Dwa bilety są następnie scalane. Jeśli mają różne wartości dla określonej właściwości, wynikowy scalony bilet początkowo używa wartości biletu różnicowego.

Scalony bilet jest następnie sprawdzany pod kątem rzeczywistych możliwości drukarki. Jeśli jakiekolwiek ustawienia w bilecie są niezgodne z możliwościami drukarki, sterownik drukarki zmienia te ustawienia przy użyciu dowolnej logiki. Zazwyczaj zastępuje domyślną wartość ustawienia użytkownika lub drukarki. Źródłem wartości zastępczych kierowcy nie jest ten sam bilet co basePrintTicket, a następnie scalony bilet może mieć pewne ustawienia, które różnią się od obu biletów wejściowych. Jeśli sterownik drukarki musi zmienić ustawienia, ten fakt jest zgłaszany we ConflictStatus właściwości .ValidationResult

Aby scalić i sprawdzić poprawność na podstawie domyślnych ustawień kolejki wydruku, należy ustawić wartość basePrintTicket lub DefaultPrintTicket .UserPrintTicket

Parametr deltaPrintTicket może mieć nullwartość , w którym przypadku basePrintTicket parametr jest weryfikowany, sprawdzany pod kątem rentowności i zwracany, prawdopodobnie ze zmianami.

scope Jeśli jest to zadanie, bilet drukowania zwrócony w ValidationResult pliku może zawierać parametry Schemat wydruku z prefiksami zadania, dokumentu i strony. scope Jeśli element jest dokumentem, ustawienia poszczególnych zadań w deltaPrintTicket programie są ignorowane, a zwrócony bilet może zawierać parametry z prefiksami dokumentu i strony. scope Jeśli element jest stroną, ustawienia poszczególnych zadań i ustawienia poszczególnych dokumentów w deltaPrintTicket programie są ignorowane, a zwrócony bilet może zawierać parametry tylko z prefiksem strony.

Dotyczy