I do not know if my question makes sense, but I will try to develop it.
Let’s say I have a classic Phoenix web application and want to add some cards printing feature. This is will be done by retrieving some data from the database and rendering them precisely on an existing svg image. Then user can print the resulted page.
This is really my first time for such a feature, not only with Elixir but all languages included. So I have really no idea where to start from.
Please, which tools, libraries, resources should I use for this?
Tutorials or open source projects also will be greatly welcome.
Note that prawn is very lightweight as it directly writes raw PDFs (you can think of PDF as a textual format). On the other hand pdf_generator uses wkhtmltopdf which might be quite heavy. There are some libraries similar to prawn for Elixir/Erlang (one even started by Joe Armstrong), but none of them have support for proper custom fonts (it’s a hard task) so that was a showstopper for me to do PDF generation in Elixir.
Anyway, due to the short time I have to implement this feature, I just reviewed my decision and I will go with simple HTML content that will be print by the user.
I found print.js, a javascript library to help printing from the web. It seems great for the job. Kind like @kokolegorille 's suggestion based on a printing stylesheet, I can specify the part of the page to be printed and pass as well the url of the css file to apply.
As a side note this is maybe one more reason for me to learn Rails as a spare wheel. ^^
Imho the best way currently to create a pdf from html in elixir is rambo+weasyprint. I had many problems with wkhtmltopdf and more complex options. Weasyprint on the other hand does what it suggests and handles css quite well.