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

Free Support Forum - aspose.com

Using Aspose Print api's from Windows Service application

Hi Roman,

Is there already a sample available of XpsPrint with use of Print Ticket information to set printer settings like copies, color/gray, paper tray,… ?

Thanks in advance.

Kind regards,
Kr

Hi Kristof,


Thanks for your interest in Aspose.Words. Please try running the ‘XpsPrint’ demo project; you can find this project in offline sample pack here. This demo project demonstrates how to use Aspose.Words for .NET to print documents using the XpsPrint API. I hope, this helps.

Best regards,

First of all thanks for the fast response.

Currently I changed the XpsPrint sample.
And I added the functionality to set some printer settings like collated, monochrome color,... through a print ticket (GetPrintTicketFromPrinter() method).

I also modified the helper class XpsPrintHelper and added an extra parameter (print ticket) for the methods: Print, StartJob and I also made a new method StartXpsPrintJob2 with the printticket object instead of the intptr object.

But when I test this implementation it remains hanging on in the method WaitForJob...

Has anyone experience with this?
You can find the modified sample in attachment.

Thanks in advance.

Hi Kristof,

Thanks for your patience. After an initial test, I managed to reproduce the same problem on my side. I have logged a new task (WORDSNET-8179) in our issue tracking system to further look into the details of this problem. Your thread has also been linked to this task and you will be notified as soon as your problem is worked out. Sorry for the inconvenience.

Best regards,

Hi,

Thanks for the fast response.
When can I expect a result of the task WORDSNET-8179?

Currently I am also testing the XpsPrint sample without the print ticket settings to see if it is working well.
When I try to print a Word document (TestDoc.docx in attachment of this post) to a physical printer (with use of the method Print(Aspose.Words.Document document, string printerName, string jobName, bool isWait, System.Printing.PrintTicket printTicket)) the result contains strange characters instead of the text I want.
Also the same result when I print a Word document to a PDF Complete Converter (PDF printer), you can find the output pdf TestDoc.pdf in attachment of this post.
When I print a Word document to the Microsoft XPS Document Writer the result is good, but this is not the solution I want (result in attachment of this post: TestDoc.xps)
When I try to print with the use of the method Print(Stream stream, string printerName, string jobName, bool isWait, System.Printing.PrintTicket printTicket) then I get an WIN32 Exception: Unknown error (0x80511001).
How can I get a good result when printing the Word document?
Thanks in advance.
Kind regards,
kr

Hi Kristof,


Thanks for your inquiry.

Regarding WORDSNET-8179, please spare us some time; we will inform you as soon as this task is worked out. Sorry for the inconvenience.

Secondly, I was unable to reproduce this issue during rendering your TestDoc.docx to PDF on my side (please see the attached output PDF). I would suggest you please upgrade to Aspose.Words 13.3.0. You can download it from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

I hope, this helps.

Best regards,

Hi Kristof,


Thanks for your inquiry.

We investigated this issue and found that the way you are calling the PrintTicketStream variable is incorrect. It needs to be defined as IXpsPrintJobStream and also as an out parameter. Additionally the technique used to pass is a little different than expected, this is demonstrated in the code of the updated project which is attached to this post. Hopefully this works correctly on your side now.

Please let me know if I can help with anything else.

Cheers,