However, simple HTML sites like, ,, worked like charm. Sites like ours and even DuckDuckGo didn’t convert to PDF or an image. It does not seem to convert web pages utilizing any code snippets successfully. Note that unlike the GUI method using a browser, using these tools via the terminal has its limitation. To make multiple copies of pages in the same PDF file, the command would be: wkhtmltopdf -copies 2 mint.pdfĪnd, if you want to exclude images from the web pages, just type: wkhtmltopdf -no-images mint.pdfĪdditionally, if you want to convert a webpage as an image, the command would look like this: wkhtmltoimage mint.png The grayscale filter may not work on every webpage, but you can try that using the command: wkhtmltopdf -g googlepage.pdf You also get a few exciting options when converting a webpage.įor instance, you can apply a grayscale filter to the PDF file, make multiple copies of the page in the same file, and exclude images during conversion. ![]() The file generated will be saved in the home directory by default. ![]() You can choose to use the complete URL as “ ” or use the domain name as shown in the example above. To convert a webpage into a PDF, type in: wkhtmltopdf URL/domain filename.pdfĪs an example, here’s how it would look: wkhtmltopdf mint.pdf It is pretty straightforward to use no matter whether you want to convert it to a PDF or image file: For Ubuntu-based distros, you can type in the command: sudo apt install wkhtmltopdf You should be able to install it from the default repository of your Linux distribution. You can explore its GitHub page for more information. It utilizes the Qt WebKit rendering engine to get the task done. That’s not surprising considering you can do a lot more in the terminal, including downloading a webpage as PDF.Ī nifty open-source command-line tools wkhtmltopdf and wkhtmltoimage come to the rescue that lets you convert any HTML webpage to a PDF or image file. ![]() You probably already know that you can browse internet in Linux terminal and even download files using the command line. Method 2: Converting a Webpage to PDF or Images Using the Terminal It allows you to edit and remove parts of the webpage before downloading the PDF. You may use a PDF editor to remove parts of it but that’s an additional task.Ī better option is to utilize a browser extension like Print Friendly. The one major problem with this simple approach is that it includes all the elements on the page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |