What is special about printing from OPV?
I have Tomcat running on a Win2003 server, with a number of printers which are in fact attached to various other machines. The printers are all configured on local ports like \\192.168.1.140\PRNT1-O2 ie the printer called PRNT1-O2 on the machine with IP address \\192.168.1.140. On the server that printer is named PRNT1-O2 - and OPV happily sees these - ie when you go to set the default printer for a practiceLocation, OPV can see all the server's printers. [PRNT1-O2 simply means Printer 1 on machine Office 2.]
This setup works happily when I print from the server itself (eg using OO Writer), or when I print from a rinky-dink java program. However, when I print from OpenVPMS, then the first print appears to work (ie OPV does not complain), but the second does not - OPV complains that the printer is not accepting jobs. If you look at the printer status, you can see that the first print has error status.
So what is the difference between printing from OPV and printing from a Java program?
[My program was cloned from the Oracle HelloWorldPrinter program and uses java.awt.print.* - looking at the stack trace in https://openvpms.atlassian.net/browse/OVPMS-1036, OPV would appear to use the same print classes.]
I have a NullPrin printer configured (which prints to NUL:) and this works happily with OPV - ie I can print from OPV to it with no error. There are no real printers connected to the server so I cannot test if OPV can print to a local printer.
The Tomcat service is running as a Local System Account - so according to my readings it has full access to everything. However, I tried creating a user Tomcat and checking that that user could print to the printers, and then starting the Tomcat service in the new Tomcat account - but this didn't fix it.
There is no firewall running on the machine.
Any ideas greatfully received.
Regards, Tim G
Re: What is special about printing from OPV?
The "java.awt.print.PrinterException: Printer is not accepting job" exception is thrown if there is an error status detected on the printer. In earlier versions of Java, these would prevent subsequent prints.
E.g. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525150
The most common solutions appear to be:
Re: What is special about printing from OPV?
Under windows 2003 it might be advisable to configure the server as the print server. In many network configurations local pcs are configured to directly print to a IP printer as opposed to every pc sending its job to 1 server who's role it is to spool and order the print queue.
Basically what this means is you configure the windows 2003 machine as a print server/manager, the printers are all added to list of managed printers.
All clients should re add the printers as network printers(even if they are local) so the jobs are recieved correctly and managed by the windows 2003 print server.
IMO this technique means that the 2003 machine is notified immediately if a printer codes an error.
2. I avoid locally connected printers at all costs. I will go to IP or network printers for every machine I can, these office grade machines are natively network printers. The only printer that I couldnt do this with was the Dymo Label printer we use for labels. Fortunately our server was positioned quite centrally so the Dymo runs directly from the server.
The portmapping that windows xp does and by default windows 2003 for these "windows" linked printers IMO is poor. Even tho the networked printers use a similar port map they just seem more inheritently robust.
We use Brother machines(wireless and hard wired, and try and avoid mixing and matching printer brands on the same network.
Re: What is special about printing from OPV?
Hi Ben,
I agree using Ip printers is the best solution as no printer relies on a PC being switched on the operate. It also is so much easier for OpenVPMS which needs to see the printers setup from the perspectve of the Tomcat service. Shared printers setup on Windows do not propogate to all users so you need to make sure the user running the Tomcat service has the printer setup permanently which can be tricky and sometimes unreliable. Local printers (usb, parallel and TCP/Ip) propogate to all users on the server.
For Dymo etc that dont have a inbuilt printer server I use a Dlink or similar USB print server which are quite cheap and work well.
Cheers Tony
Re: What is special about printing from OPV? FIXED
I fixed the problem - by clearing everying using the Windows Resource Kit program cleanspl.exe, then downloading the latest drivers for every type of printer I needed and then reinstalling all the required printers.
I have absolutely no idea why this fixed the problem.
For the benefit of others who may encounter this problem, the error I was getting in the system event log was error 6161 for the print process with the text:
The document Java Printing owned by SYSTEM failed to print on printer LABEL-R2. Data type: NT EMF 1.008. Size of the spool file in bytes: 65536. Number of bytes printed: 0. Total number of pages in the document: 1. Number of pages printed: 0. Client machine: \\OPV-WIN2003. Win32 error code returned by the print processor: 0. The operation completed successfully.
Regards, Tim G