Let's work on pdf.cr

Hello, I’m working on a fork of pdf.cr. It’s dedicated to generate a pdf file in pure crystal(instead of just wrapping a foreign library). I am also interesting in building a similar lib,however,this lib is just at it’s very beginning. Therefore, I forked this repo and started to complete it(here is my fork.

if this project can be finished, we can form a complete lib of pdf generator,therefore it can be used in other projects like file converters.


Nice! What do you think about porting an existing pure Ruby library that generates PDF to Crystal instead?

As I know there is a ruby lib called prawn,and it is my major reference(though I sometimes get overwhelmed by it). Fow now I’m trying to implement the types in the pdf specification(ver 1.3).In order to implement the full prpject, I need fuurther improvements on my architect ability.

Do you have some preferred examples?


That’s so exciting. I’ve been looking for a prawn equivalent for quite a while :+1:

1 Like

This is a great initiative. I used the wkhtmltopdf-crystal few years ago, but as you mention, it’s a wrapper foreign library. I’ll take a look at pdf.cr. I didn’t know it’s existance. Thanks for having us posted.


This is a nice presentation on creating PDF files


I recently created GitHub - threez/hpdf.cr: Create PDF documents in crystal using libhpdf / libharu it is not pure crystal but uses a c library. However it would allow you to build an abstraction on a higher level.

Generally I think we should less rewrite but more reuse. This way we can stand on the shoulder of giants. What is your opinion?


This is quite convenient and pragmatic,except one problem. Since I work mainly on windows, I wonder if there is a haru available on windows,and how should I link extern libs in different OSs.

what if we port a pre-compiled haru within the shard? or should Windows users install this lib on their own?

1 Like

It seems to be a tutorial basic enough for me. is there other addresses available? there’s some problem for me getting these contents(contless timeout errors)

There’s a download button on it, here’s the URL for the PDF of the slides https://files.speakerdeck.com/presentations/6d1b3e5d3ae3403e80eb2515b7ac8e17/Let_s_write_a_PDF_file.pdf

Good point regarding windows I think as soon as windows is supported we would need a concept in general in crystal. Or is there already a way to support it?