
Ask HN: Recommendations for generating pdf/docx reports in code? - gitgud
Looking at generating reports in a system we&#x27;re building.<p>There&#x27;s tonnes of options, does anyone have any experience or recommendations?
======
dredmorbius
Pandoc.

[https://pandoc.org/](https://pandoc.org/)

------
tmaly
I have used a Perl module PDF::API2 to make some nice pdf reports with tables
and images about 10 years back. The reports are still being generated to date.

------
sebst
Princexml did a good job when I used it years ago, as well as TCPDF did.

Recently, I only used weasyprint, which works like a charm for my needs.

------
nivethan
We generate html pages and then convert them using wkhtmltopdf. It works
pretty well and the simplicity of it is nice.

~~~
gitgud
We have implemented that in the past, but had some issues. How do you deal
with; page headers, footers, title page, contents, page numbers etc...?

~~~
jamespaden
Those things can be really difficult with the browser-based libraries because
the browsers don't yet (and seemingly never will) support CSS Paged Media.
That's why commercial engines like Prince and DocRaptor (which uses Prince)
exist. These engines were designed for document generation and have much
better support for headers/footers, table of contents, page numbers, etc,
etc..

Disclaimer: I work for DocRaptor

[https://drafts.csswg.org/css-page-3/](https://drafts.csswg.org/css-page-3/)

~~~
gitgud
Yes I've only just learnt about the paged media proposal, sounds like a useful
api...

I would prefer if the report generating technology is server-based, as we
can't guarantee what apis the browser will have...

Thanks anyway, I'll check out docraptor

------
LarryMade2
Using what programming language? - this is important.

~~~
gitgud
We're open to any language, since it will just be running in a docker
container

