I had some problems with doc.print on windows 2008R2 servers which didn’t print or does take very very long. Is this a known issue? ( I need to investigate it further)
So in the meanwhile i also changed my code to an extra option to print a document.Your advise was XPS. Everything prints fine and fast on my testprints except one thing. It does not take the right paper trays. It works flawless with doc.print but the same doc does not do it right with XPS printing. So your conversion to XPS doesn’t give the right paper trays in the XPS file?
If this is not working then XPS printing is useless for the most of my customers.
Do i something wrong or can i do something in my doc to make it work?
Thanks for your inquiry. It would be great if you please share your input document along with XPS file here for testing. I will investigate the issue on my side and provide you more information.
*MNI:
So in the meanwhile i also changed my code to an extra option to print a document.Your advise was XPS. Everything prints fine and fast on my testprints except one thing. It does not take the right paper trays.*
Please share your code for which you are getting undesired output. We will check this scenario and provide you more information on this.
*MNI:
It works flawless with
doc.print but the same doc does not do it right with XPS printing. So
your conversion to XPS doesn’t give the right paper trays in the XPS
file?*
Could you please share what do you mean by XPS printing? Are you printing your document to Microsoft XPS Document Writer or using XpsPrint code from here? Please share some detail about this query.
Hello Tahir,
Sorry for my late response.
To answer your questions:
Yes, i use your “XpsPrintHelper.vb” module to print
So my code is simple:
Dim doc As New Document(New MemoryStream(sFileContent))
XpsPrint.XpsPrintHelper.Print(doc, printerName, "Wordmerge", False)
The attachment is a Word document which i used for this. In this document i set the paper trays to:
First page: paper Tray 2
Second page : paper tray 1
Third and further : paper tray 2
When i use the doc.print functionality from aspose.word it works flawless
When i use the above lines to generate a XPS file which be directed to the choosen printer, the selection of the paper trays is not correct/does not work. It just print all the pages from the default paper tray of the printer.
Hope to hear from you what i can do
Aspose.Words reads values from document in Raw
format (i.e. as int) and after Print method is called, a function
compares the Raw value of PaperTray of current page and values in
PrinterSettings.PaperSources and if it doesn’t find coincidence,
function returns “Automatic” value. Then it passes the value for
PaperTray to underlying Windows function that actually sends document to
printer.
You
should also note that paper tray numbers are printer specific. I
suppose the problem might occur because paper trays numbers specified in
your document do not match paper tray numbers of the printer running on
your local environment. So, first of all you should make sure that
paper trays in your document are specified correctly.
In Microsoft Word printer trays are defined per section and are printer specific. Therefore you can programtically change these values by using the FirstPageTray and OtherPagesTray properties of the PageSetup class for each section.
Please let me know if I can be of any further assistance.
Hello Tahir,
The paper trays are specified correctly because when i print it through Doc.print or In Word itself it just works fine. It does not work when i print it via your XPSHelper.
It did read somewhere something about public/private trays through the available PrinterSettings.PaperSources. Is this something which i can set on my printer?
I don’t understand what you mean by set the values FirstPageTrayFirstPageTray which are defined per section. Is a section the same as a page in Word or what is defined as a Section in a Word document?
So is it possible with these variables to set page 1 to tray2, page 2 to tray 1 and page three and further to tray 2?
Do you have an Example of this 2 variables on how to programtically set these? Maybe then i understand it better
Thanks for your inquiry. I have attached the modified code of XpsPrint with this post. Please try it at your end and let us know if you face any issue. Hope this helps you.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.