Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 22nd, 2003, 09:53 AM
RobinR RobinR is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: New Jersey
Posts: 77 RobinR User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 2 m 21 sec
Reputation Power: 6
Lightbulb Java: Print Button

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

Reply With Quote
  #2  
Old March 22nd, 2003, 11:57 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Java: Print Button


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT