• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Printing file without opening it

 
Rohit Ahuja
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1932
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic