Thursday, September 23, 2010


PDF Generation using Smalltalk

Marten Feldtmann is working on pdf creation using libHaru, he published a first, not ready code for a wrapper around libHaru.

But I already wrapped this small library for Pharo/Squeak two years ago with a more natural Smalltalk interface. So one can write:

| document page image |
document := PDFDocument new.
page := document addPage.
image := document loadPNGImage: 'Image.png'.
page drawImage: image rectangle: (Rectangle origin: 72@72 extent: 144@144).
document saveToFile: 'documentWithImage.pdf'

My library is also mentioned as one of the options for generating PDF on the seaside PDF page.

I made the code available at and licensed it with MIT. Would be good if Marten will have a look and maybe port my code to VAST before doing any unnecessary work on his side...

Independent from that I would still like to write/see a PDF framework written in plain Smalltalk (similar to Java's iText).

The more I think about it the more I like the idea:

However - time is limited. But if anyone is interested feel free to contact me...

BTW: did you know that Bruno Lowagie (author of iText) changed the license of his Java PDF library to block his government.


there is allready some work done on (pure) Smalltalk pdf generation:

But my gut feeling is that implementing full, or at least significant part of pdf specification would be a huge undertaking.
Yes, but Hans-Martin PDFReader does not write and SPDF is the one from Bruce that I mentioned.

Maybe the one from Dwight could be a base but it's not published.

I know that implementing the whole spec would be a massive amount of work but look at Seaside. It started easy and has grown one step after the other. If there would be enough interest in the community I think it is possible...
Well, I would certainly be great to have such Smalltalk library. What worries me is that seems that most of the work that needs to be done, is getting very intimate with the pdf specs, caveats, unwritten usage patterns, and behavior of popular implementations. I see that general implementations like libharu have thrown a lot of energy in that area, and all that would need to be redone for Smalltalk implementation. And realistically, general pdf projects can probably throw much more resources (man hours) at that task than (I am afraid rather small) Smalltalk community.
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?