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 ? ...
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
subject: Using the printer: generating data on-the-fly