We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding print ticket information to an XPS document

I have a pdf document that I need to convert to xps and add print tickets before sending to printer. I able to convert pdf to xps but don’t know how to add print tickets (or printing information) to the document before sending to the printer.

I need to be able to set the following:

  1. Input and output tray/bin
  2. Orientation (landscape or portrait)
  3. Color or black and white
  4. Duplex mode

In addition to these, is there a list of all items that I can set for the print job/ticket?


You can surely use the JobPrintTicket Class offered by Aspose.Page to achieve your requirements. In case you face any issues, please feel free to share with us.

Are there code examples that I can reference?


You can try following code to make your printer print an XPS document in duplex mode:

doc.JobPrintTicket = new JobPrintTicket(JobFeature.JobDuplexAllDocumentsContiguously.TwoSidedLongEdge);


doc.JobPrintTicket = new JobPrintTicket(JobFeature.JobDuplexAllDocumentsContiguously.TwoSidedShortEdge);

depending on the page flip method. Furthermore, a task has been logged in our issue tracking system to add code examples in the API documentation for this feature. We will let you know as soon as it is done. Please spare us some time.

I am using .Net and api reference for .Net seems to be missing https://reference.aspose.com/page

How can I set specific InputBin? AutoSelect is the only option. Also what about setting orientation and color options? and what’s the difference between Job and Document features?

  XpsDocument doc = new XpsDocument(filePath);
	doc.JobPrintTicket = new JobPrintTicket(JobFeatures.JobDuplexAllDocumentsContiguously.TwoSidedLongEdge, JobFeatures.JobInputBin.AutoSelect);
	doc.JobPrintTicket = new JobPrintTicket(DocumentFeatures.DocumentDuplex.TwoSidedLongEdge, DocumentFeatures.DocumentInputBin.AutoSelect);


We are looking into this matter and will get back to you soon.


We are checking the issue of missing API references and will fix it soon.

As for specifying an InputBin feature, Aspose.Page basically provides an interface for constructing print tickets. So, AutoSelect was not designed as the only option available, but as the simplest version of the InputBin feature.

You can construct your own features (not just InputBin) referring to https://docs.microsoft.com/en-us/windows/win32/printdocs/printschema. Or, more exactly, for example, https://docs.microsoft.com/en-us/windows/win32/printdocs/jobinputbin. As for InputBin feature, it can be constructed like this:

document.JobPrintTicket.Add(new JobFeatures.JobInputBin(
                new Option("psk:optionName",
                    new Property("psk:propertyName1", new Value(propertyValueType1 /*see ValueType class consts*/, "propertyValue1")),
                    // ...
                    new Property("psk:propertyNameN", new Value(propertyValueTypeN /*see ValueType class consts*/, "propertyValueN")),
                    new ScoredProperty("psk:scoredPropertyName1", new Value(scoredPropertyValueType1 /*see ValueType class consts*/, "scoredPropertyValue1")),
                    // ...
                    new ScoredProperty("psk:scoredPropertyNameM", new Value(scoredPropertyValueTypeM /*see ValueType class consts*/, "scoredPropertyValueM"))

As for page orientation, there are corresponding constants in the Features.PageOrientation class. For example, document.JobPrintTicket.Add(Features.PageOrientation.Portrait);

As for color options, these feature must be constructed manually according to the Print Ticket Schema.

In fact there is no difference between particular features that could be found in both the JobFeatures and DocumentFeatures classes. But as the feature sets are different for jobs and documents, We grouped them into separate classes. So the features from JobFeatures are meant to be used in job print tickets, and the features from DocumentFeatures are meant to be used in document print tickets.

This print tickets interface is actually quite raw. We didn’t improve it much because it wasn’t considered a highly required feature. So maybe it’s time to get back to it. PAGENET-372 has been logged for this purpose.

As for examples in docs, yes, the article must be written. But it will take some time and we will let you know once the ticket is resolved.