|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
The Java Print Service API added in SDK 1.4 has the following new packages:
javax.print javax.print.attribute javax.print.attribute.Standard javax.print.event I would like users to be able to print out a JSP internet page using a print button that functions the same way File > Print works. When a user presses the button, a print dialog would appear. If I simply wanted to print the page without a print dialog, how would that work? I do not want the print button itself to be a Swing component that requires an ActionListener. Do you have code for this or know where I can find a tutorial? Thanks, Robin |
|
#2
|
|||
|
|||
|
I doubt you can use java to print a web page. If you could you would have to have an applet on the page and the user would ahve to have the 1.4.1 plugin - at best.
You have to realize that jsp runs server side, and all the API's you have at your disposal are not available once the document reaches the client (browser). If you want to use java client side, you have to use an applet. Now, if you just want a button on a web page that initiates print, then you can use javascript. Code:
<input type=button onclick="window.print()"> This will bring up the exact print dialog that a user gets when using File->Print. Just to be thorough, do realize that java/jsp and javascript are not related. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Java: Print Button |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|