Elixir libraries for converting docs

Recently am working with a scenario where I need to convert a JSON payload into HTML and then convert it to PDF. While working on it I came across - elixir-pdf-generator library(GitHub - gutschilla/elixir-pdf-generator: Create PDFs with wkhtmltopdf or puppeteer/chromium from Elixir.).
It made me curious what if someone wants to convert it into different file formats like docx. Do we have any general library for handling different scenarios??

For PDFs I’d recommend data |> heex |> HTML+CCS3-paged-media |> prince/docraptor

most cost effective processor for CSS3 paged media. ca 800$ for a local licence.

docraptor is an easy to use webservice backed by prince. (about 10ct per PDF)

very good resource for print-css: https://www.print-css.rocks/
Tutorial and benchmarks of processors (also free ones)

For .docx there is pandoc, which has a Elixir wrapper that I never used.

2 Likes

100% for that workflow. I did the equivalent with Python -> Handlebars templates -> wkhtmltopdf and it worked well for moderately complex PDF docs:

3 Likes

Yes, one can try using a free processor. But if you start fighting it, start thinking about what your time is worth to you. As I said print-css-rocks has a good overview of what the (free) processors can do. Prince, PDFReactor and Antennahouse are way more capable than the free ones. In terms of support I can only speak for docraptor: very good.