crystal-community / crystal-libraries-needed

A list of libraries that are needed or wanted for the Crystal-Language
141 stars 4 forks source link

PDF Writer #40

Open marceloboeira opened 7 years ago

marceloboeira commented 7 years ago

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!

crisward commented 6 years ago

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

arambert commented 5 years ago

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

arambert commented 5 years ago

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

marceloboeira commented 5 years ago

@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.

arambert commented 5 years ago

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

straight-shoota commented 5 years ago

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

marceloboeira commented 5 years ago

@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.

straight-shoota commented 5 years ago

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.

alexanderadam commented 5 years ago

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

rowland commented 5 years ago

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.

alexanderadam commented 5 years ago

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 commented 3 years ago

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?)

gettalong commented 3 years ago

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.

alexanderadam commented 3 years ago

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: