• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Java Printing (automated)

Ranch Hand
Posts: 333
Mac Eclipse IDE Safari
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic