DEV Community

Discussion on: A reliable way to create PDF from HTML/markdown, with PDF specific features

Collapse
olexandrpopov profile image
Oleksandr Popov

Our team has been working on a document generation project and we convert HTML to PDF using wkhtmltopdf. For example we generate documents like this using only HTML and CSS. wkhtmltopdf has a great CSS support. Regarding page breaks we can control them using page-break-before and page-break-after properties.

As for alternatives, recently we started to use docx templates and process them with docxtemplater and convert to PDF with libreoffice headless.

Collapse
patarapolw profile image
Pacharapol Withayasakpunt Author • Edited on

Apparently, I find that pandoc alone can be powerful enough.

New page is as easy as \newpage. (I know, LaTeX syntax in Markdown.)

Also, geometry: margin=1cm in YAML frontmatter.

Also, LaTeX can be used to host and join PDF.

But, is there a best tool that can easily do all these?

BTW, I found Puppeteer unreliable.