{"id":937,"date":"2015-01-09T10:52:27","date_gmt":"2015-01-09T10:52:27","guid":{"rendered":"https:\/\/intelligentbee.com\/blog\/?p=937"},"modified":"2024-08-28T12:27:46","modified_gmt":"2024-08-28T12:27:46","slug":"how-to-create-pdf-files-from-html","status":"publish","type":"post","link":"https:\/\/intelligentbee.com\/blog\/how-to-create-pdf-files-from-html\/","title":{"rendered":"How to Convert Web (HTML) Pages into PDF Files"},"content":{"rendered":"<p>Here&#8217;s a collection of steps needed to create PDF files directly from HTML web pages.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_68_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/intelligentbee.com\/blog\/how-to-create-pdf-files-from-html\/#How_to_Convert_Web_HTML_Pages_into_PDF_Files\" title=\"How to Convert Web (HTML) Pages into PDF Files\">How to Convert Web (HTML) Pages into PDF Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/intelligentbee.com\/blog\/how-to-create-pdf-files-from-html\/#How_to_Convert_Web_HTML_Pages_into_PDF_Files-2\" title=\"How to Convert Web (HTML) Pages into PDF Files\">How to Convert Web (HTML) Pages into PDF Files<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Convert_Web_HTML_Pages_into_PDF_Files\"><\/span>How to Convert Web (HTML) Pages into PDF Files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If you&#8217;re working on a Ubuntu Linux machine, the first thing you need to do is to install the <code>WKHTMLTOPDF<\/code> library, by\u00a0running the following commands into your terminal:<!--more--><\/p>\n<pre class=\"lang:sh decode:true \">sudo apt-get install wkhtmltopdf\r\nsudo apt-get install xvfb\r\nsudo su\r\necho 'xvfb-run --server-args=\"-screen 0, 1024x768x24\" \/usr\/bin\/wkhtmltopdf $*' &gt; \/usr\/bin\/wkhtmltopdf.sh\r\nexit\r\nsudo chmod a+x \/usr\/bin\/wkhtmltopdf.sh\r\nsudo ln -s \/usr\/bin\/wkhtmltopdf.sh \/usr\/local\/bin\/wkhtmltopdf<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"How_to_Convert_Web_HTML_Pages_into_PDF_Files-2\"><\/span>How to Convert Web (HTML) Pages into PDF Files<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Once the installation is complete, simply\u00a0run the following command to make sure that everything went well:<\/p>\n<pre class=\"\">wkhtmltopdf http:\/\/www.google.com output.pdf<\/pre>\n<p>This will generate a PDF file called <code>output.pdf<\/code> which will contain a preview of the Google&#8217;s homepage.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a collection of steps needed to create PDF files directly from HTML web pages. How to Convert Web (HTML) [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[192],"yst_prominent_words":[355,1396,1787],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/937"}],"collection":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/comments?post=937"}],"version-history":[{"count":3,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/937\/revisions"}],"predecessor-version":[{"id":133206,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/937\/revisions\/133206"}],"wp:attachment":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/media?parent=937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/categories?post=937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/tags?post=937"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}