HTML to PDF with HTMLDoc on Debian 10 /Debian 9 / Ubuntu / Linux Mint

Windows Articles

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...
angeloma
angeloma
Senior Writer and partner

PDF is a fairly common format today for distributing documents. It has great popular support and is widely supported by many communities. In addition to this, almost all office tools support it on almost all known platforms. From the desktop with Windows, Linux, MacOS and BSD; to the mobile with Android and iOS. Then it’s a good idea to have tools that can take advantage of them. Today, I will teach you how to install and use HTMLDoc to generate a PDF file based on HTML.

What is HTMLDoc?

HTMLDOC is a program that reads HTML and Markdown source files or web pages and generates corresponding EPUB, HTML, PostScript, or PDF files with an optional table of contents.

One of the best things about this program is that it is released under GPL v2. That is, we will have no problem using it. If you are a developer, it is also a great advantage because we can include or use them in our project without problems.

How to install and use it?

The program is available for Linux through the official repositories of each distribution. This at least, in Debian and derivative. However, you can download the source code from GitHub. It is not very large.

In Debian and derivatives, just open a terminal and run the following:

:~$ sudo apt install htmldoc

Once the installation is complete, we are ready to begin.

First of all, I recommend you to check the help page of the command. To do this, type:

:~$ htmldoc --help

1.- HTMLDoc help
1.- HTMLDoc help

As we can see there are many options that alter the operation of the command. One thing to keep in mind is that HTMLDoc does not support CSS or Emojis correctly. So be careful. To get it up and running, just use this command:

:~$htmldoc --webpage -f [output_file].pdf [input_file]

However, you can use a webpage on the [input_file] field.

If we want to modify the margins, we can do it with these options:

  • –top
  • –bottom
  • –left
  • –right

Another quality of HTMLDoc is to allow not to compress anything of the resulting file so as not to lose quality. For this use the --no-compression option.

As you can see, it’s easy to use.

Tell us, have you used it? do you like it? have you integrated it into your projects? Let us know in the comments

Please share this post with your friends.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install Lighttpd on Ubuntu 20.04?

There are many web services in Unix but we always look for the one that best suits our needs. In this case,...

How to install Docker on Ubuntu 20.04 / Debian 10?

Docker is a fairly popular technology in today's sysadmin. It is logical to think because it means a complete change in the way images...

How to install Mantis Bug Tracker on Ubuntu 20.04?

Hi, folks. In this post, I will help you to install Mantis Bug Tracker on Ubuntu 20.04 If you...

How to install WordPress with Nginx on Ubuntu 20.04?

Hi, folks. In this post, we will help you install Wordpress with Nginx on Ubuntu 20.04. It's a lot easier than you...

Electron 9.0 available

News has arrived that many developers are going to love. And that is that Electron this great cross-platform application framework has released...