• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System BSD

HTMLDoc: PDF From HTML Markup (UNIX FreeBSD)

How VPS by How VPS
September 1, 2019
in BSD
0
0
SHARES
19
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Using a Different System?
  2. Update FreeBSD 11.2 (x64)
  3. Install and initialize the Ports Collection
  4. Installing HTMLDoc
  5. Install Nano
  6. Generating your first PDF document from HTML markup
  7. Want to contribute?

Using a Different System?

  • Install HTMLDoc on Fedora 29

  • Install HTMLDoc on CoreOS

Are we missing a guide for your target system? Request one, or submit your own!


Have you ever wanted to be able to generate PDF files on-the-fly without having to spend hours setting up your server environment? HTMLDoc will turn properly formed Markup (HTML 3.2) to PostScript (PDF 1.6), dynamically.

For this example, we will be utilizing Vultr’s FreeBSD 11.2 (x64) with IPv4, although it all works the same with IPv6 only servers. Keep in mind, we’re working with a brand-new FreeBSD install, and as such we will go through the steps of setting up a FreeBSD machine to correctly and safely take on new applications such as HTMLDoc.

Update FreeBSD 11.2 (x64)

First things first, on FreeBSD we need to update the system if you haven’t done so already. Log in as root and run the two following commands, the first command will seek out and retrieve updates, if available, while the second command is only useful to install an update if indeed one was fetched.

freebsd-update fetch
freebsd-update install

Note: When presented with installation or configuration options simply use the default choices. Furthermore, when asked Y/N questions just answer Y on all prompts.

Install and initialize the Ports Collection

First, fetch the updates for the Ports Collection. This step will take several minutes.

portsnap fetch extract

Once this process is done, we will see the following output.

Building new INDEX files... done.

Now, we install the updates we just fetched.

portsnap fetch update

Next, we install portmaster.

cd /usr/ports/ports-mgmt/portmaster
make install clean

Now that we’ve installed portmaster, an application that helps us install applications from the Ports Collection, we can update any outdated ports in our system.

portmaster -a

This is a very long process, but as such, it is indeed the best process in getting your machine up to date, secured and ready to install HTMLDoc and, in-turn, churning out PDFs on-the-fly. This process will definitely take several minutes, up to 30 minutes.

If any errors are encountered during this process just add the –f switch, which will upgrade and rebuild all the ports, in essence:

portsnap -af

The update is done when you see the following output.

===>>> Done displaying pkg-message files

Installing HTMLDoc

Now, we can install HTMLDoc from the Ports Collection. You’ll be asked if you would like to add the GUI front-end to the application. This is entirely optional. All other options should be left to default, and simply go through the motions of installing all the dependencies for HTMLDoc. You’ll notice plenty of dependencies, such as animated PNG support, jpeg-turbo, Babel, NASM, CMake, py27 and a whole lot more, including curl. This is why we update the system before installing HTMLDoc, for there are quite a number of dependencies which may cause installation issues if the system is not up to date. This step will take the longest.

cd /usr/ports/textproc/p5-HTML-HTMLDoc/ && make install clean

Finally, when you see the following lines displayed, we’re done installing HTMLDoc:

===>  Cleaning for p5-HTML-HTMLDoc-0.10_2

Install Nano

Since the next example uses Nano, we will install and link it now, like so.

cd /usr/ports/editors/nano && make install clean
ln -s /usr/local/bin/nano /usr/bin/nano

Generating your first PDF document from HTML markup

Let’s move on over to /tmp/ to play around and test out HTMLDoc.

cd /tmp/

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

nano markup-source.html

Add the following HTML markup.

<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 the file by hitting CTRL + X to exit Nano editor, press Y followed by ENTER to save your changes. Now, you can instruct HTMLDoc, via the command line, 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 in the /tmp/ directory, 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”.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How to Install Couch CMS 2.0 on a FreeBSD 11 FAMP VPS

Next Post

Configure MariaDB on OpenBSD 6

Next Post

Configure MariaDB on OpenBSD 6

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet