Install HTMLDoc on Debian 9

Introduction

HTMLDoc will dynamically parse Postscript (PDF 1.6) documents from correctly written Hypertext (HTML 3.2). This will allow you to generate PDF files on-the-fly, without having to spend hours setting up your server environment or having to pay enormous sums of money to acquire said capability. It can be used for all type of documents, from receipts and invoices to brochures and documentation, and much more.

In this tutorial, you will learn what is needed to install HTMLDoc on Debian 9.

Once HTMLDoc has been installed, we shall continue by creating a simple one-page document, with no headers, footers, borders or extras. In essence, an HTML template capable of taking advantage of the entire printable area of a PDF document.

Preparing Debian 9 (x64) for HTMLDoc

For this tutorial, we will be working with Debian 9 (x64) server with IPv4. Keep in mind, this works the same with IPv6 only servers as well. First things first, we need to check for updates for installed packages, more so considering most all distributions of Linux are not configured to install security patches or system updates automatically. Furthermore, installing updates to the software, as well as the kernel itself, is always advised, especially when dealing with a new installation.

Now, we need to check to see if there are any updates or upgrades available for your system:

apt-get update && apt-get upgrade -y

We have now fully updated our software packages, we can now install HTMLDoc:

apt-get install htmldoc -y

You are now ready to start generating PDF documents from HTML markup.

Generating Your First PDF from HTML

Let’s quickly test this newfound capability from the command-line. Move over to the /tmp/ directory for testing:

cd /tmp/

Now, let’s create a simple HTML document, which we will use to generate a PDF document. We can call it markup-source.html:

nano markup-source.html

Add the following HTML markup to it:

<html>
<head>
    <title>My first PDF from HTML</title>
</head>
<body>
    This is the body of my first PDF document made from HTML.
</body>
</html>

Save it by hitting CTRL + X to exit Nano editor, then input Y to save the changes. You can now instruct HTMLDoc to parse a PDF document from your markup-source.html file:

htmldoc --webpage -f postscript-output.pdf markup-source.html

You will now have a new file named postscript-output.pdf with a title of "My first PDF from HTML" and a body of "This is the body of my first PDF document made from HTML". Congratulations, you have learned how to turn simple HTML markup to highly transportable PostScript PDF documents.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Install PiVPN on Debian

Introduction An easy way to set up a VPN server on Debian is with PiVPN. PiVPN is an installer...

How to Install GitLab Community Edition (CE) 11.x on Debian 9

Since GitHub was acquired by Microsoft, quite a few developers have planned to migrate their own...

How to Install RainLoop Webmail on Debian 9

RainLoop is a simple, modern and fast web-based email client. RainLoop source code is hosted on...

Powered by WHMCompleteSolution