Ruby, JavaScript, Sass, iOS. Stinky Cheese & Beer Advocate. Working at CustomInk and loving it!

PDF::Writer For Ruby 1.9

If you have legacy code written for ruby 1.8 and you want to run 1.9 and support your old PDF::Writer code, then just jump right over to my Github pdf-writer fork and get it.

$ gem install metaskills-pdf-writer

If you are interested in knowing some of the dirty details about what pitfalls are under 1.9, read on. The biggest thing for me was getting used to the character encodings. Including string literals in your code that are say UTF-8 or some other encoding will blow up on you real quick. I highly highly suggest that you read James Edward Gray II: Everything About Ruby 1.9 Character Encoding Series series. He covers all the basics. If you want to see what two commits I did for pdf-writer, see here and here. The second one is very very hackish, it basically add a marshaling support to the Mutex class which 1.9 does not have. The reason this is needed was due to pdf-writer's use of transaction simple to roll back object state as it is drawing across multiple pages. If you are like me and wish all your PDF::Writer code was in Prawn, your not alone!