MetaSkills.net

PDF::Writer For Ruby 1.9

Posted On: May 14th, 2009 by kencollins

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.

sudo 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!

Resources

Ken Collins

  HOMEPAGE  | May 14th, 2009 at 09:41 AM
Ken Collins Just an additional note, this gem of pdf-writer is 1.8.7 and 1.9.1 compatible. It will not work under 1.8.6 as it does not have transitional code/methods in place.

GarykPatton

  HOMEPAGE  | June 16th, 2009 at 05:18 AM
GarykPatton Hi. I like the way you write. Will you post some more articles?