Jump to content

Save page as PDF function?


kanc3lamistrad
 Share

Recommended Posts

Dear all, This is my first post on this thread, and I really hope I could receive some help from you. I am trying to search for a line code that could download a web page as a PDF. On my site, I managed to put a javascript function to print a web page with “window.print()”, but I don’t know how to save it as a PDF. The code for printing web page is: <script type="text/javascript">window.print();</script> Can you please help me save a page as PDF with a javascript function? Thank you in advance,Alex

Link to comment
Share on other sites

AFAIK, there are no functions in JavaScript that allow you download, save, or print a file in any format other than the format it's already in. In other words, JavaScript can't convert files to different types. PHP can generate PDF files using certain libraries, like FPDF. I think that's about your only option.

Link to comment
Share on other sites

Guess I should have been a little more general. JavaScript does not have access to local file systems. That's a security risk. It may be able to read certain files, but it certainly cannot create or save files.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...