This documentation is archived and is not being maintained.

PrintQueue.MergeAndValidatePrintTicket Method (PrintTicket, PrintTicket)

Merges two PrintTickets and guarantees that the resulting PrintTicket is valid and does not ask for any printing functionality that the printer does not support.

Namespace:  System.Printing
Assembly:  System.Printing (in System.Printing.dll)

public ValidationResult MergeAndValidatePrintTicket(
	PrintTicket basePrintTicket,
	PrintTicket deltaPrintTicket


Type: System.Printing.PrintTicket
The first print ticket.
Type: System.Printing.PrintTicket
The second print ticket. This can be null.

Return Value

Type: System.Printing.ValidationResult
A ValidationResult that includes the merged PrintTicket and an indication of whether any of its settings had to be changed to guarantee viability.


At least one of the input print tickets is not valid.


The basePrintTicket is null.


The validation, merger, and viability checking operation failed.

The method produces a viable print ticket; that is, a ticket that does not request printing features that the printer does not support. The method first validates the two input print tickets against the Print Schema. If either is invalid, an exception is thrown.

The two tickets are then merged. If they have different values for a particular property then the resulting merged ticket initially uses the value of the delta ticket.

The merged ticket is then checked against the actual capabilities of the printer. If any settings in the ticket are incompatible with the printer's capabilities, then the printer driver changes those settings by using whatever logic it wants. Typically, it substitutes the user's or printer's default value for the setting. It the driver's source of substitute values is not the same ticket as basePrintTicket, then the merged ticket might have some settings that are different from both of the input tickets. If the printer driver has to change any settings then this fact is reported in the ConflictStatus property of the ValidationResult.

To merge and validate based on a print queue’s default settings, you should set basePrintTicket to the DefaultPrintTicket or the UserPrintTicket.

The deltaPrintTicket parameter can be null, in which case the basePrintTicket is validated, checked for viability, and returned, possibly with changes.

With this overload of MergeAndValidatePrintTicket, both the deltaPrintTicket and the PrintTicket in the ValidationResult that is returned have job wide scope. To specify a different scope use the other overload of this method.

The following example shows how to use this method to merge two print tickets and respond to the ValidationResult that is returned.

/// <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;
            Console.WriteLine("PrintTicket new duplexing setting is set on '{0}'.", queue.FullName);
            // 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);
        // 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);

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.