This is a CLI for converting HTML files to PDF documents. Under the hood it uses the openhtmltopdf library. If you'd like to try it out online before downloading, please see the sandbox.
You will need Java (JRE or JDK) installed on your machine (version 8 or above). You can download a version for your platform at Azul.
Please visit the releases page.
Usage: java -jar openhtmltopdf-cli-1.0.10-1.jar convert [-bqvx] -i=<input> -o=<output>
Converts a single html file into a PDF
-b, --block Block linked resources (CSS, images, fonts)
-i, --input=<input> The html input file
-o, --output=<output> The PDF output file
-q, --quiet Quiet logging
-v, --verbose Verbose logging
-x, --xhtml Use to specify that the input file is valid XHTML
(skipping the HTML to XHTML step)
java -jar openhtmltopdf-cli-1.0.10-1.jar convert -v -i doc.html -o doc.pdf
<html>
<head>
<style>
@page {
@top-right {
content: "Page " counter(page) " of " counter(pages);
}
}
.greeting {
font-size: 25px;
text-align: center;
color: orange;
}
</style>
</head>
<body>
<h1 class="greeting">
Hello World!
</h1>
</body>
</html>