Export XPS with support for input tray

We are using your XpsPrint example (XpsPrintHelper) to send XPS documents to a printer. The XPS files are created by exporting to XPS: document.Save(stream, SaveFormat.Xps). The Save occurs on a server PC with no printers installed. The XPS image is then shipped to another PC that sends the XPS to the appropriate print queue.

The specific question I have is support for ‘First’ and ‘Other’ paper input tray codes. These codes are in the RTF and are set via the aspose page format settings in the document prior to saving as XPS. The proper print ticket does not come out in the XPS (as best as I can tell), which I suspect is because a printer with that tray defined does not exist on that PC.

I need to confirm if that is the case, and alternately how we can support the ‘first’ and ‘other’ input tray codes when exporting XPS from Aspose.

Thanks.

Hi Blake,

Can you please share your input document with complete code and a screenshot to display original and expected output?

Best Regards,

Code sample, the question is pretty simple:









doc.Sections[0].PageSetup.FirstPageTray = firstPageBin;

doc.Sections[0].PageSetup.OtherPagesTray = otherPageBin;



using (var stream = new MemoryStream())

{

asposeDoc.Save(stream, SaveFormat.Xps);





}







The code above sets the first and other page bin codes for an Aspose document and then saves as XPS to a stream.



The question is: Is the ‘Save’ method above designed to output XPS that contains PrintTickets that reflect the changes made to the document’s First and Other page format settings?



We do have the proper printer specific print codes to input into the PageSetup properties above, but they don’t appear to be included in the XPS stream created by the Save command.



[…sorry, your webpage does not appear to be putting line breaks in]

Hi Blake,

Yes, Aspose.Words exports tray settings when you save a document as XPS however it is possible the default tray will be used if you print from a different printer, different operating system or different version of printer driver.

Please share your input Word document if you feel tray settings are not exported when your document was saved to XPS.

Best Regards,

Attached is a simple RTF document created in Word, PageTrays.rtf. It was created by selecting a printer and then setting the: Page Setup, Paper, Paper Source, First and Other settings to some values specific to that printer. These happen to be ‘Tray 1’ for First, and ‘Tray 2’ for Other, the printer specific codes are 258 for first, and 257 for other. I then save as RTF.





When I load that document into an Aspose.Document object and look at the Section.Page I see what I expect to see; ‘FirstPageTray’ = 258, and ‘OtherPagesTray’ = 257.





So far so good.





Now I want to ‘Save’ (not print) the document to XPS format and preserve those tray settings. Attached is the XPS output, PageTrays.xps. The tray settings are gone. If I dig into the XPS print tickets I see this:





For page 1:

psf:Feature name=“psk:PageInputBin”

psf:Option name=“psk:AutoSelect” /

/psf:Feature





For page 2:

psf:Feature name=“psk:PageInputBin”

psf:Option name=“psk:AutoSelect” /

/psf:Feature



(that is xml with the brackets removed)

I understand that whatever is generating the XPS stream needs access to the actual printer that defines those numbers (257, 258). If I ‘Print’, then I can hand the settings to the Print method, but I cannot do that when I ‘Save’.





So the question is, when I ‘Save’ as XPS, how do I indicate to that method the Printer Settings to use to resolve those tray settings so that the resulting XPS has the proper bin settings?

Hi Blake,

Thanks for the details. This issue has been logged into our issue tracking system as WORDSNET-12229. We will keep you updated on this issue in this thread.

Best Regards,