共用方式為


XPS OM Print Ticket Interfaces

This IXpsOMPrintTicketResource interface of the XPS Document API provides access to an existing print ticket and also the ability to create a print ticket in an XPS OM.

The IXpsOMPrintTicketResource interface enables a program to read the contents of an existing print ticket by calling the GetPrintTicketResource method of an interface that supports a print ticket. New print ticket resources can be added to a document part by calling SetPrintTicketResource.

There are three print ticket levels, which specify the scope of the print ticket. The print ticket levels are: the job (or package) level, the document level, and the page level. The following table shows the relationship between the print ticket level, the corresponding XPS OM interface, and the methods used to access the print ticket resource.

Print Ticket Level Interface Get Method Set Method
Job IXpsOMDocumentSequence GetPrintTicketResource SetPrintTicketResource
Document IXpsOMDocument GetPrintTicketResource SetPrintTicketResource
Page IXpsOMPageReference GetPrintTicketResource SetPrintTicketResource

 

The content of an existing print ticket resource can be accessed by reading from the stream associated with the resource. The GetStream method of the IXpsOMPrintTicketResource interface returns the pointer to a read-only stream that contains the XML-formatted contents of the print ticket. The format of the print ticket content is described in the Print Schema Specification.

A new print ticket resource can be created by creating a new IXpsOMPrintTicketResource interface. A valid, XML-formatted print ticket is written to a stream and a part URI is created to identify the print ticket part. For more information about the content of a valid print ticket, refer to the Print Schema Specification. The stream and the part URI are passed as parameters of the SetContent call to set the new print ticket resource and the print ticket resource is added to the corresponding document part by calling the SetPrintTicketResource method shown in the preceding table.

Print tickets inherit the properties of print tickets with greater scope. For example, a document-level print ticket inherits the properties of the job-level print ticket that is associated with the document's document sequence. Likewise, a page-level print ticket inherits the properties of the document-level print ticket that is associated with the page's document. In this inheritance process, properties that are specified in the lower-level print ticket override the corresponding properties that would otherwise be inherited from the higher-level print ticket.

Print Schema Specification

IXpsOMDocument

IXpsOMDocumentSequence

IXpsOMPageReference

IXpsOMPrintTicketResource

XML Paper Specification