jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Java Printing (automated) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Printing (automated)" Watch "Java Printing (automated)" New topic
Author

Java Printing (automated)

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 196

I have an application written by myself which creates XML documents as the result of specific transactions and as such I have control over their content. I would like to write a separate routine (probably without any GUI) that will constantly monitor the contents of a directory for XML files. Once found a document will be read (parsed) and a report generated. I would like to embed the name of the print queue in the XML document so that multiple prints can be sent to various printers. In actual fact the report will simply consist of a stream of ASCII codes sent to a barcode printer and as such it would be desirable to either bypass a printer driver or use something like a 'Microsoft Generic Printer' to avoid any additional formating to the data.

So my questions :-

Can you programatically specify the name of a printer without invoking a conventional printer selection dialog box.

Can you make this printer the 'default' as you can in Windows (albeit manually from the printers folder).

I want to send data to a networked printer without a driver messing around with the data. The current VB6 application just prints to a generic text only printer driver - is that still the best approach ? Even a generic text only driver can wrap lines and insert perforation skips if you are not precise when you setup the queue.

Lots questions, sorry about that.

Dave
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
Back in the old days you could just send bytes to LPT1: and that would be it.... no intermediary. But I'm sure your code isn't going to have an imbedded print driver, is it? So I conclude that you WILL need to use a printer driver.

I would be asking if there was a way to drop a file onto a printer (on a Windows platform, I presume). Then your program could read the file, pulling out the destination printer, create a file for printing, and then the magical step of dropping the file on the printer would happen. But you'd need to use some native code to do that. Someone else might have done it for you. Let us know what you find.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Printing (automated)
 
Similar Threads
Help: I have an is it possible question?
Parameter vs Tag
Printing - Defaults !
JPS - printing to IPP printer
Printing Problems