16.1 C
Texas
angeloma
Senior Writer and partner

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

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.

- Advertisement -

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.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article