printing HTML from Swing app in Windows ...

G

Giovanni Azua

Hello all,

I have a Swing application that dynamically
generates HTML documents, I need to let the
user print the document but because of the
little support of HTML flavor I could not have
the Print Service API working for me.

Another important remark is that this app is
currently only used in Windows. Is there a way
to have the explorer directly print the html
document I have tried something like e.g.

Runtime.getRuntime().exec("explorer -print " + url.toString());

using the Windows Shell but does not work
i.e. explorer does not print directly a file.

Thanks in advance,
Best Regards,
Giovanni
 
T

Tim Jowers

Giovanni Azua said:
Hello all,

I have a Swing application that dynamically
generates HTML documents, I need to let the
user print the document but because of the
little support of HTML flavor I could not have
the Print Service API working for me.

Another important remark is that this app is
currently only used in Windows. Is there a way
to have the explorer directly print the html
document I have tried something like e.g.

Runtime.getRuntime().exec("explorer -print " + url.toString());

Giovanni,
post to an IE group. I think the Windows Scripting Host (WSH) will
probably be what you are looking for to cause IE to print. Or maybe an
old-school Windows app that sendMessage. One other lazy way will be to
put a JavaScript in each HTML file. onload it can call to print.

Best luck,
Tim
 
G

Gerbrand van Dieijen

Hello all,

I have a Swing application that dynamically
generates HTML documents, I need to let the
user print the document but because of the
little support of HTML flavor I could not have
the Print Service API working for me.

Hello,

Using JEditorPane, you render and then print HTML documents.

I've used the DocumentRenderer class to print:
http://www.ftponline.com/javapro/codepage.asp?loccode=jpep021210kg

(I implemented my own printable jeditorpane first, but this one was
slightly better, like multiple page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top