IXpsFixedDocumentSequenceWriter.PrintTicket Property


Sets a PrintTicket for the FixedDocumentSequence that is being written.

Namespace:   System.Windows.Xps.Packaging
Assembly:  ReachFramework (in ReachFramework.dll)

PrintTicket PrintTicket { set; }

Property Value

Type: System.Printing.PrintTicket

A PrintTicket that represents a default printing configuration for the sequence.

Setting this property does not validate or modify the specified PrintTicket for a particular PrintQueue. If needed, use the MergeAndValidatePrintTicket method to create a PrintQueue-specific PrintTicket that is valid for a specified printer.

The following example shows how to use the PrintTicket property to associate a PrintTicket with the FixedDocumentSequence.

// ------------------------- AddPackageContent ----------------------------
/// <summary>
///   Adds a predefined set of content to a given XPS document.</summary>
/// <param name="xpsDocument">
///   The package to add the document content to.</param>
/// <param name="attachPrintTicket">
///   true to include a PrintTicket with the
///   document; otherwise, false.</param>
private void AddPackageContent(
    XpsDocument xpsDocument, bool attachPrintTicket)
        PrintTicket printTicket = GetPrintTicketFromPrinter();
        // PrintTicket is null, there is no need to attach one.
        if (printTicket == null)
            attachPrintTicket = false;

        // Add a FixedDocumentSequence at the Package root
        IXpsFixedDocumentSequenceWriter documentSequenceWriter =

        // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - -
        IXpsFixedDocumentWriter fixedDocumentWriter =

        // Add content to the 1st document

        // Commit the 1st Document

        // Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - -
        fixedDocumentWriter = documentSequenceWriter.AddFixedDocument();

        // Add content to the 2nd document.

        // If attaching PrintTickets, attach one at the FixedDocument level.
        if (attachPrintTicket)
            fixedDocumentWriter.PrintTicket = printTicket;

        // Commit the 2nd document.

        // If attaching PrintTickets, attach one at
        // the package FixedDocumentSequence level.
        if (attachPrintTicket)
            documentSequenceWriter.PrintTicket = printTicket;

        // Commit the FixedDocumentSequence
    catch (XpsPackagingException xpsException)
        throw xpsException;
}// end:AddPackageContent()

.NET Framework
Available since 3.0
Return to top