jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions about this topic in the past, I’m interested in any recent developments or current libraries that the community recommends. Key features I’m looking for include support for complex layouts, text styling, and custom tables. Any insights or suggestions would be greatly appreciated!
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixir-ls
- #ai
- #elixirconf-us
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Hermanverschooten
There (sadly) is no real equivalence to Prawn for Elixir.
There are 2 libraries, pdf and mudbrick. The first is more mature, uses
GenServers to store the state of the pdf being build, where the second one is very new and still lacking a lot of features, but it uses astructto store the state.Mudbrickis easy to extend with your own features, wherepdfis practically impossible to extend.Mudbrick supports OpenType (otf) fonts, pdf, adobe type mananger (atm).
If you do not want to shell out to something like
htmltopdf, these are currently the most feasible options.The font-handling in pdf was recently rewritten, making it compile several times faster.
I have been using pdf for several years, tried mudbrick, I like it, but is not yet there.
kokolegorille
If You really miss prawn, You can run it in Elixir with erlport…
_io2
We have had great success with https://wkhtmltopdf.org/
Within our phoenix application, a simple GenServer calls out to the wkhtmltopdf binary, passing along generated html and returning the resulting pdf file.
The html itself is generated from a bunch of
$template.html.heexfiles and for each new PDF document type we simply add a new*.html.heexfile.We produce a lot of different types of pdf reports, and regularly add new ones so this approach (converting html → pdf) makes it easy to assign that task to anyone who can write html, and allows us to produce some very rich, and complex page / document designs.
olivermt
Nothing can compare to the production experience of GitHub - bitcrowd/chromic_pdf: Convenient HTML to PDF/A rendering library for Elixir based on Chrome & Ghostscript · GitHub imo
dimitarvp
I wanted to bring it up but assumed they were not okay with the Chromium dependence.
lccezinha
Here we are using GitHub - gutschilla/elixir-pdf-generator: Create PDFs with wkhtmltopdf or puppeteer/chromium from Elixir. · GitHub for simple PDF and it has been working fine for the last years
outlog
+1 for wkhtmltopdf
egze
Nice. Didn’t know about mudbrick. A modern native Elixir PDF writer would be so cool for the ecosystem.
mindok
It depends what you’re looking for, but we use typst (https://typst.app/). We use it to generate high quality output for work instructions (images, pixel perfect layout, table of contents etc etc). Having used it for that, I’d also use it for things like database reports, invoice generation etc. It’s also deterministic - it doesn’t rely on browser engines etc to interpret CSS, so once you have placed elements on a page, they stay put.
There’s a command-line version that compiles to a single binary (it’s written in Rust, so easy enough to add to your docker builder image for most platforms [I think that’s the lingo - I’m no docker whiz]. Build time is a couple of minutes, but the guys at Alembic designed the docker build to minimise the likelihood that it needs to be recompiled for each deploy). We’re currently just calling it with
System.cmd. The main downer is you have to assemble all the inputs (e.g. images, JSON data extracts) into the directory where the main.typfile is, so no referencing images on the web. There are Elixir bindings, but for our use-case isn’t wasn’t worth the extra dependency.The output quality is awesome (it is designed as a Latex successor). Coding up the layout is very similar to composing views with Phoenix function components. Some of the syntax takes a bit of getting used to, but it’s still the least fighting I’ve been through to get nice quality output from a database to a PDF or printer, by a long way, in >30 years of doing this kind of stuff.
Edit: PS - tables allow fine control on layout, styling, row/col-spans etc.
outlog
Took a look at what I used last time around, and it was https://weasyprint.org, probably due to the nice templates out of the box.. you render the html, path to the css file, and call it using Rambo (you might need
{:rambo, github: "/myobie/rambo", branch: "aarch64-apple"},)..