crystal-libraries-needed icon indicating copy to clipboard operation
crystal-libraries-needed copied to clipboard

PDF Writer

Open marceloboeira opened this issue 7 years ago • 14 comments

I've starter building one, but I haven't got that far yet.

https://github.com/marceloboeira/pdf.cr

We could create a label: "Need contributon" or something!

marceloboeira avatar Jun 05 '17 08:06 marceloboeira

Not sure of your use case, but shelling out to wkhtmltopdf is a good stop gap to go from html > pdf.

crisward avatar Sep 27 '17 18:09 crisward

@marceloboeira your repository hasn't been updated in the last 3 years (almost). Have you made any progress outside of github?

arambert avatar Oct 30 '18 14:10 arambert

It would be awesome to have in crystal something similar to prawn in ruby.

arambert avatar Oct 30 '18 14:10 arambert

@arambert unfortunately not, but my goal was to look at the first commits of prawn and other pdf libs in ruby to create something like an MVP. if you are up for the challenge @arambert we can tackle it together.

marceloboeira avatar Oct 30 '18 14:10 marceloboeira

@marceloboeira maybe ;) I'll let you know!

arambert avatar Oct 30 '18 14:10 arambert

Maybe it would be a good aproach to start with an existing graphics library that can emit PDF, for example Cairo. There are already Crystal bindings to it: https://github.com/TamasSzekeres/cairo-cr

straight-shoota avatar Oct 30 '18 15:10 straight-shoota

@straight-shoota I thought of that too, it's just sometimes a bit hard to distribute given that you need the C libs are coupled. Most of my crystal libraries were focused on learning about things as well, so trying to build from the scratch, but for the sake of productivity I would say we can try to do that for sure.

marceloboeira avatar Oct 30 '18 19:10 marceloboeira

Even with something like Cairo it's gonna be a long road to get somewhat decent PDF rendering capabilities. You'll still need to implement a lot of things you would expect from an ordinary PDF builder.

straight-shoota avatar Oct 30 '18 21:10 straight-shoota

It seems that @rowland is giving it a try [if I understand this correctly].

alexanderadam avatar Jul 01 '19 09:07 alexanderadam

I've written PDF libraries in Delphi, Ruby and Go, but I've never cracked the most difficult languages to support, such as Chinese. My immediate goal in Crystal is to bind PDFlib, which my company is using anyway, and build a report markup language on top of it. Not as ideal as having an open source, pure Crystal library, but more attainable in the short term.

rowland avatar Jul 01 '19 14:07 rowland

In the long term something like hexapdf would be nice. Maybe a port would make sense.

But for the moment I would be happy with any library that works. :wink:

EDIT: It seems that @gettalong is planning on porting it to Crystal :tada:

alexanderadam avatar Jul 01 '19 19:07 alexanderadam

I'm not sure whether this is relevant for anyone but gettalong published the source at https://github.com/gettalong/hexapdf.cr

It's not finished but maybe someone wants to support it (or maybe merge some projects?)

alexanderadam avatar Oct 31 '20 15:10 alexanderadam

Big caveat from my side wrt to the code: It was and is just a proof of concept for benchmarking purposes. The code you see in there is probably equivalent to just the first few weeks of HexaPDF development which started in 2014...

Nonetheless, I'm still dreaming of a standalone HexaPDF executable written in Crystal :smile: The library part would just be a nice side effect of this.

gettalong avatar Oct 31 '20 18:10 gettalong

Nonetheless, I'm still dreaming of a standalone HexaPDF executable written in Crystal

Trust me: everybody here does! :wink: Also thank you again for working on PDF libraries in general. :pray: As I told you some time ago, PDF is pure magic and complexity to me. :wink:

I just stumbled about the Go library unipdf which directories are nicely structured and show the complexity that PDF brings. Apart from that I never saw intentionally obfuscated code for commercial use on GitHub… :roll_eyes:

alexanderadam avatar Oct 31 '20 18:10 alexanderadam