wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Using the printer: generating data on-the-fly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Using the printer: generating data on-the-fly" Watch "Using the printer: generating data on-the-fly" New topic
Author

Using the printer: generating data on-the-fly

Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Hi,

My program needs to send some data to the printer. The catch: the data to print is calculated dynamically, "on the fly" ; it's not taken from any static file (though I'm willing to generate a temporary file if necessary).

Furthermore, my printable data contains both *text and images* (with some layout , e.g: "logo image on the top, then some text, then logo image at the bottom").

Being new to java Printing, I'd appreciate any hints as to how to go about it.
What format would you use to describe text + images + layout ? It should be understandable by the Printer, but also easy to generate through java... postscript? PDF ? HTML ? ...

Thanks
H Lander
Greenhorn

Joined: Oct 23, 2005
Posts: 15
One way you can do it is to use HTML. You can load the HTML into a JEditorPane which you can display on the screen. This will give you the full power of HTML for laying out the material to be printed. That's the easy part.

The hard part is printing the JEditorPane. I've used a commercial package which does this, its called the "Java Print Dialog Framework". See their web page for details: Soft Frame Works
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using the printer: generating data on-the-fly