4

I need to print an XPS document directly to a Printer on a Windows XP platform. I'm using the Microsoft XPSPrinter (from C#) similar as in this example here. Everything works fine on Windows 7, however when printing on WinXP I get this:

enter image description here

The problem is that on another WinXP installation, printing the exact same document, works "occasionally" (yep... -.-) and I'm not able to understand what causes it to work/break...

Some background info:

  • I print from a ConsoleApplication using .Net 4.0 in 32bit mode
  • The XPS document is generated by Aspose.Words on an IIS web server
  • The XPS document is written to a temporary file which is being passed to the PrintTicket..
  • The XPS document in the temporary file location seems to be perfectly fine when opening it with the XPS viewer...so at least it is correctly downloaded from the server and saved to the FS
  • Always printing the same document: Works on Win7, occasionally works on one WinXP, never works on another WinXP (so there must be something different...but what??? Ideas??)
  • On the "working" XP machine, it often also prints partially correct, meaning only some of the symbols in the middle are wrong
  • Always works when the DLL containing the printing code is executed from an ActiveX (don't ask)...never works on that machine when executing the same DLL from a ConsoleApplication.

Trials so far which didn't work:

Tried so many stuff that I'm a little lost what else I could try. Appreciate any ideas what could be the cause for such odd printing of the documents.

Community
  • 1
  • 1
Juri
  • 32,424
  • 20
  • 102
  • 136
  • Are either of the XP machines using a locale / language other than en-US? Are all of the XPS documents generated on the same IIS server and then printed on separate computers? – Jon Feb 10 '14 at 21:59
  • Both seem to have en-US...but I guess I found the problem. Need to verify it but at the moment it seems to run. I'll post an update once I'm sure it works – Juri Feb 10 '14 at 22:15
  • Are you printing from a Windows Service? This seems to cause the same problem. – Tony Edgecombe Feb 20 '14 at 13:18
  • no, we're launching a console app basically passing it a file to be printed. It seems to work now. Apparently the problem was that the main console app process terminated "too fast"...it's like the print spooler for the XPS doc didn't get "everything" although that really sounds strange. I'm still investigating. So far it seems to work now..I'll post an update in a couple of weeks when I'm sure it's working as expected. – Juri Feb 24 '14 at 22:55

0 Answers0