aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Printing file without opening it 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 "Printing file without opening it" Watch "Printing file without opening it" New topic
Author

Printing file without opening it

Rohit Ahuja
Ranch Hand

Joined: Oct 04, 2001
Posts: 121
Hi guys,
I have a JSP page which has a hyperlink to a pdf file. I want to print this PDF file without opening it... Can someone help me out with this, and it is real fast and urgent...


Face Off.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are going to have to open the file in order for it to print... Now you have 2 options. Since you are going to be opening a pdf, it is going to take control of the browser. You are not going to be able to run any commands to print it.
There is another method. You can use frames and have the top frame(zero height) print the bottom frame containing the pdf and close the entire window after calling print. BUT the problem you are going to run into is the following,...You would not know how long to set the timeout for since you do not no page loading time. 2 when it says to print, the print dialog is going to pop up so it will not be so seamless when it closes, and some browsers may not even want to print it.
Sure I lost you with my bad grammer.....
Pain in the rear....eh....
But this is good since I would not want someone printing 1000 pages on my printer when I visit a website!
Persoanlly I would say.....click on the link and print out this form....
Eric
Chris De Vries
Ranch Hand

Joined: Dec 05, 2002
Posts: 65
You can try the following:

Should work on any unix machine with wget and xpdf installed, and a postscript printer or interpreter. Should also work with windows under cygwin.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Sending this to the HTML and Javascript forum, since it's more dealing with the proper use of hyperlinks and all that gobbledy gook Eric is talking about
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61628
    
  67

This is a dupe of this topic in the JSP forum.
I think a server-side approach is best, but in any case, one of these should be closed and refer to the other. Since I can, I'm closing the topic in JSP and referring it here.
(Though I actually think Servlets is the most appropriate locale.)
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Printing file without opening it