DEV Community

loading...

Discussion on: What tools do you use for server side PDF generation?

Collapse
tux0r profile image
tux0r

Use a Word or OpenDocument template (or another of your choice). Use LibreOffice in headless mode to search and replace the fields (you can use ###VAR1### or whatever you like) in your document by the generated values. Then convert it:

libreoffice --headless --convert-to pdf your-document.docx
Enter fullscreen mode Exit fullscreen mode

That should do.

Collapse
christianca profile image
Christian Córdoba Author

Well that approach looks interesting too. We'll look into it, thanks :)

Collapse
justinemailone profile image
justinemailone

Great suggestion. Looking into it lead me to pyoo which seems to be the best way to go for my use case.

pyoo link:
pypi.org/project/pyoo/

Related article:
blog.pyspoken.com/2016/07/27/creat...

Another similar library that might be useful:
relatorio.readthedocs.io/en/latest...