Add and manipulate print tickets

Create, edit, link and get print tickets of XPS files via C++

 

In the context of XPS files, a print ticket is a set of instructions that specifies how a document should be printed. It's essentially a configuration file that contains information about:

  • The dimensions and orientation of the printed pages.
  • The paper tray or feeder is to be used.
  • The resolution and color depth of the printed output.
  • Whether to print on both sides of the paper.
  • The order in which pages should be printed and collated.
  • Any additional finishing options, such as stapling, binding, or hole punching.

By understanding and utilizing print tickets, you can optimize the printing process and achieve the desired output for your XPS documents.

Aspose.Page API solution among the different other features allows working with print tickets. Here you will find information that explains how to create, edit, get and link them. To manipulate print tickets of XPS files, we need:

-

Aspose.Page for C++ API which is a feature-rich, powerful and easy-to-use document manipulation and conversion.

-

Open the NuGet package manager, and search for Aspose.Page and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command

    PM> Install-Package Aspose.Page

Steps to create a custom print ticket C++.

  1. Set the path to the documents directory.
  2. Create an XPS file using the XpsDocument Class .
  3. Add a custom job print ticket using the JobPrintTicket Constructor.
  4. Add a custom page parameter initializer and a custom page resolution option to the ticket.
  5. Save the changed XPS document using the XPsDocument.Save() Method.
Create a custom print ticket

Steps to edit XPS print tickets via C++.

  1. Set the path to the documents directory.
  2. Open XPS Document with print tickets using the XpsDocument Class.
  3. To remove the not needed parameters from the ticket use the Remove() Method.
  4. Save the document with the changed job print ticket by means of the XPsDocument.Save() Method.
Edit a print ticket

Steps to get print tickets via C++.

  1. Set the path to the documents directory.
  2. Open XPS Document with print tickets using the XpsDocument Class.
  3. Create the job print ticket with the JobPrintTicket Constructor.
  4. Create the document print ticket using the GetDocumentPrintTicket() Method.
  5. Get the page print ticket using the GetPagePrintTicket() Method.
  6. Save the document with changed job print ticket by means of the XPsDocument.Save() Method.
Get a print ticket

Steps to link print tickets for the XPS file via C++.

  1. Set the path to the documents directory.
  2. Create a new XPS file and open XPS Document with print tickets using XpsDocument Class.
  3. Open the XPS Document with print tickets using XpsDocument Class
  4. Link the job print ticket with the JobPrintTicket Constructor.
  5. Link the document print ticket using the GetDocumentPrintTicket() and SetDocumentPrintTicket() Methods
  6. Link the page print ticket using the GetPagePrintTicket() and SetPagePrintTicket() Methods.
  7. Save the document with changed job print ticket by means of XPsDocument.Save() Method.
Link a print ticket

XPS What is XPS File Format

XPS format is similar to PDF format. Both are page description language (PDL) formats. EPS is based on HTML and not on PostScript language. The .eps file is capable to contain a markup of the document's structure along with the information on how the document would look like. There are also added instructions on how to print and render the document. The feature of the format is that it fixes the document's description which means that it will look the same no matter who and from what operational system opens it.