Chrome is, quite possibly, the best tool for generating a good looking PDF from an HTML file. Surprisingly, they offer a command line interface for this.
html2pdf
will convert a local .html file to PDF by invoking chrome.
It can also handle HTML that’s been piped in.
Should work on macOS, Linux, and FreeBSD
Prerequisets: Chrome
Usage: html2pdf [-i input_file.html | -o output_file.pdf | -h]
-h Display this help message
-i specify the path to a file to convert
-o specify the name/path to the output file
If you don't specify an input file STDIN will be used.
If you don't specify an output file ./output.pdf will be created.
If your file doesn't end in .html Chrome will treat it as text
Metadata:
Tags: