Hi all,

I need to know this one. I have web application and i need functionality like client have certain pdf file on his/her local system. I want to use html/javascrpit to print these pdf files without opening.
Thanks in advance.

Recommended Answers

All 4 Replies

You can not and will not be able to open files on the computer of your visitor, this is due to security reasons. Do you know what you could do if you could acces the files on the visitor's computer?

> Read their personal files
> Plant a virus
> Steal their identity
> Take over their computer

However, you can use a form to allow visitors to upload a file (in your case pdf) to the server, and then open that on-server and return the result to the visitor.

You should search the web on how to make a upload form and how to read pdf files (I'd suggest using PHP).

~G

You can not and will not be able to open files on the computer of your visitor

Javascript is perfectly capable of opening files on the client side and displaying or printing them on the client side.

Javascript is perfectly capable of opening files on the client side and displaying or printing them on the client side.

Within security limits, of course.

If you have modified browser security to open local host pdf file then you can load it to iframe and call window.print().
if browser has installed pdf plug-in then everything will work good.
If your browser does not have modified security then you can load pdf file from server only (using some http request). Even if your server is localhost you need use http url instead of os system path to pdf file

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.