aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Printing through Javascript? Urgent!!! 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 through Javascript? Urgent!!!" Watch "Printing through Javascript? Urgent!!!" New topic
Author

Printing through Javascript? Urgent!!!

Gaurav Jain
Ranch Hand

Joined: Mar 11, 2004
Posts: 108
I have a PDF document which is kept on a certain location on the server.My requirement is to print that particular document on the client side without opening up that document, using javascript.
Is this possible? If yes then any pointers will be highly appreciated.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are going to have to open up the document in some method or another! There is no other way of doing it.

The best thing to do is open up a hidden i-frame and print that frame:


You can print the iframe with:


Eric
Gaurav Jain
Ranch Hand

Joined: Mar 11, 2004
Posts: 108
Eric,
Since the frame is hidden the file whcih is mentioned in the src of IFRAME is not getting printed.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can try making it 0 pixels high, or show it breifly when it is printed.

Eric
Sandeep Deshmukh
Greenhorn

Joined: Dec 06, 2004
Posts: 16
Hi everybody

I want to do something similar to Gaurav.
But my question is the pdf file going to be downloaded to client machine.
Also i want to know how to give path of the pdf in src tag of frame. will it be absolute path of it on the server or if relative how to give relative path or url.

With regards
Sandeep


Java and Oracle Programmer
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Linking to the pdf is just like linking to any other file/html page located in your web directory.

If the files is viewed/opened on a page, it will be saved in their cache.

Eric
 
Consider Paul's rocket mass heater.
 
subject: Printing through Javascript? Urgent!!!