Where do you find the specs for the PDF format?
I would also like to make a suggestion. I personally think that code that is shared with others should be easier to follow. One of the things that helps with that a lot is clear variable names. I have no idea what @cr, @pr, or @ti are for. Comments are also helpful. I'm not complaining, just suggesting.
James C Loesch