Back in March, I announced the Ruby Mendicant project after several readers of this blog encouraged me to pursue the idea. For those who didn’t see the follow up details elsewhere, here’s the readers digest version:

Thanks to 70 donors, and donation matching from Ruby Central, Inc. and MountainWest Ruby LLC, I am now able to take 22 weeks off from my commercial work to focus on open source development in Ruby. I had a number of project ideas, but the general consensus is that my time would be best spent building a fast, sleek, and simple PDF library for Ruby. I’ve decided to call this library Prawn, for the time being.

Since I have just reached my first checkpoint on the project, I figured I’d give folks an update on where things are.

Development on the project officially began on April 15th, but admittedly, it has been a slow ramp-up from there. I decided to give myself a few days to acquaint myself with the massive 1310 page specification Adobe provides for PDF. However, within a week I was able to put together a rough outline of my development plans.

I’m happy to say I’m already getting a lot of help. The good folks at Active Reload hooked me up with a free Lighthouse instance for Prawn, which has been a dream to work with so far. Beyond infrastructure, I’ve also been getting other help. I ran a few of my initial design ideas by David Black, and have been working actively on high level design with James Edward Gray II. If I want to claim that Prawn will be a clean and beautiful library to work with, I figured I’d need to get the insight of some Ruby masters.

Implementation-wise, it’s unrealistic to expect contributions this early in the game. Nevertheless, I’ve been receiving a ton of help from James Healy, Ruport’s resident PDF expert and maintainer of PDF::Reader. He even prototyped line drawing for me, which was a great way to get started on Prawn.

So after a couple weeks of development, what can Prawn do? The answer is best shown by a picture:

The code to generate this hexagon looks like this:

pdf = Prawn::Document.new
pdf.fill_color "ff0000"
pdf.fill_polygon [100, 250], [200, 300], [300, 250],
                 [300, 150], [200, 100], [100, 150]
pdf.render_file "hexagon.pdf"

Though it’’s not terribly exciting to look at, Prawn now has all the primitives you’ll need to do basic drawings. It supports Bezier curves, lines, circles, and polygons. It has full color support, though you’ll find it to be a whole lot more barebones than PDF::Writer (it only supports HTML/CSS formatted RGB color strings e.g.”f0f2cc”). I’ve used PDF::Writer’s page geometries to allow you to set the page sizes to a huge amount of different formats, from US Letter to A4 and god-knows-what-else. Banded together, these features make up Hadean Prawn, the first checkpoint on the geologic timescale of the project.

Prawn is still missing a lot of higher level graphical functions, implementing only a tiny fraction of what you might find in other libraries. It is intentionally dumb about a lot of things, and I assume I’ll need to circle back and extend functionality substantially down the line. Right now the focus is on being tiny, and keeping things as simple as possible.

There are already several examples in the source to get you started, if you’re the adventurous type. There is also a full spec suite, which I plan to make as comprehensive as possible to make Prawn easily hackable and a bit more stable than the current PDF libraries available in Ruby.

In the coming weeks, I’ll be working on the next checkpoint, which is Archean Prawn. This will be approached in the same way Hadean Prawn was, but with a focus on text primitives rather than graphics. I have no idea if I will focus on internationalization just yet, but it is definitely an important goal of Prawn. I will do some reading about this and figure out the details, and let folks know what I find out.

If you want to get involved with Prawn at this point, my best suggestion is to go track the project on github. You can also keep an eye on Prawn’s Lighthouse for updates. I’ve been using the wiki and tracker actively, so it’s worth keeping an eye on. Finally, you can come look for me (<sandal>) in #ruport or #prawn on Freenode if you’d like to chat.

If you’re interested more in the meta-aspects of things, i.e. the Ruby Mendicant project itself, please come join our google group and share your thoughts. Because this an effort funded by the community, for the community, I’d like the give everyone the opportunity to voice their thoughts and opinions.

I plan on doing a status update like the one you’ve just read once every couple weeks or so, but in the mean time, if you’d like to get involved, please do so!

See you in a couple weeks when Prawn has basic text operations and maybe more.