Export (0) Print
Expand All

ValidationResult Structure

Represents a merged PrintTicket that is guaranteed to be viable, with a report of any settings that were changed to make it viable.

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

[ComVisibleAttribute(false)]
public struct ValidationResult

The ValidationResult type exposes the following members.

  NameDescription
Public propertyConflictStatusGets a value indicating whether a conflict occurred between the functionality supported by the printer and the functionality requested in the initial merger of two source PrintTickets.
Public propertyValidatedPrintTicketGets a PrintTicket object that results from the merging of two PrintTicket objects, which might have been adjusted to ensure its viability.
Top

  NameDescription
Public methodEqualsDetermines whether the specified ValidationResult is equal to the current ValidationResult. (Overrides ValueType.Equals(Object).)
Public methodGetHashCodeGets the hash code associated with the ValidationResult and its PrintTicket and print stream. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns the fully qualified type name of this instance. (Inherited from ValueType.)
Top

  NameDescription
Public operatorStatic memberEqualityDetermines if the specified ValidationResult objects are equal.
Public operatorStatic memberInequalityDetermines if the specified ValidationResult objects are not equal.
Top

If the initial PrintTicket asks for printing functionality that the printer does not support, the printer driver resolves all conflicts in order to produce a viable ticket.

The following example shows how to use the values of this type while merging two print tickets.

/// <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);
    }
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft