File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes How to print out file from the web? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to print out file from the web?" Watch "How to print out file from the web?" New topic
Author

How to print out file from the web?

yen hoang
Ranch Hand

Joined: Apr 05, 2009
Posts: 58
Hi all,
I must build an web application which has print function ( through Printer) a form with data get from the database.
I don't know how to do
Please guide me!
Thanks a lot!


I love Mozart (^o^)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Printing on the server or the client?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
yen hoang
Ranch Hand

Joined: Apr 05, 2009
Posts: 58
Website has this function, and user can use it (he must have his own printer)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

So you want the user to be able to print out the current html page? or something else? A PDF perhaps?

Please include more details so we don't have to keep asking you these questions.
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
You are probably looking for window.print() JS function.
Call this JS function on 'on click' event of Print button:

yen hoang
Ranch Hand

Joined: Apr 05, 2009
Posts: 58
Sorry for the inconvenience!
I have a form (html/jsp), and Print button. When user clicks this button, this form will be printed out , just like you print a word file
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Moved to the JavaScript forum as you'll need to use JavaScript for this.
Kavin Ge
Greenhorn

Joined: Aug 30, 2009
Posts: 1
did you find another way to do this except using javascript function ??
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Kavin Ge wrote:did you find another way to do this except using javascript function ??

Write a message out telling the user to choose File --> Print? You need JavaScript to do anything dynamic.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: How to print out file from the web?
 
Similar Threads
Printing number of records from a ResultSet
Printing HTML page using Java Print Service API by converting to Postscript
uploading a file to the server
Calling "winspool.drv" from Java
Printing from a jsp page- java attributes...?