Trending News
Home / Web Development / CSS / Save the HTML or PHP webpage as PDF – JAVASCRIPT

Save the HTML or PHP webpage as PDF – JAVASCRIPT

Hi all,
Save the HTML or PHP web page as .PDF format using Javascript. It’s simple and useful, window.print() method is used for saving or printing the page as pdf. The print() method prints the contents of the current window or opens the Print Dialog Box. We have to connect the printer through the computer and choose the path(download/desktop/any folder) and save the web page.The web page save as pdf same web page style.
Three Concept are used for this operation:

  • HTML or PHP
  • Javascript
  • CSS



All web page content are specified (div,h1,h2,p,img) here. First div specify the content of HTML page, include both image,heading and paragraph or content.second div used to specify the function call.

The Javascript

This is used for performing print operation. Call forprint() from html and performe the operation in javascript, window.print() used for print or save the web page as pdf.


Describe the presentation of an html tags.


If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

Loading Facebook Comments ...
Social Media Auto Publish Powered By :