Skip to content

wkhtmltopdf

E. F. Haghish edited this page Aug 28, 2016 · 1 revision

Description

Pandoc software which is the main file convertor engine of MarkDoc package requires a LaTeX distribution in order to create a PDF document. In other words, if users wish to write their documentation in Markdown and produce a PDF file using Pandoc, they must also have LaTeX on their machine. However, MarkDoc allows producing PDF documents from Markdown and HTML documents, using another third-party software called wkhtmltopdf, which can be automatically installed within Stata using the install option.

There are several user-written packages that produce HTML files from Stata. These packages can get benefit from wkhtmltopdf to convert their HTML files to PDF. Therefore, this command was written to simply allow the users to convert their HTML files to PDF.

Syntax

wkhtmltopdf converts HTML files to PDF and the general syntax of the command is as follows:

wkhtmltopdf [arguments] filename.html filename.pdf

The command can take many arguments which are documented here. Using the correct arguments is crucial, especially if your HTML document includes several JavaScript programs.

Examples

convert html file to pdf

. wkhtmltopdf myfile.html myfile.pdf

Remarks

Unless you have installed the required third-party software using the install option, you should use the weave setup command to define the permanent path to the wkhtmltopdf software.