Prawn: Turning Tables Part 1

This post begins a series on my changes to Prawn to support rotated table text.

Prawn is a fast ruby gem for creating acrobat files. I use it to create reports and invoices. However, it does not have support yet for rotating table text. If you want to rotate your headers 90 degrees you are out of luck:

There is a rotate_around option which lets you specify any of :upper_left, :upper_right, :lower_left, :lower_right or :center. But this doesn't work either:

Lastly, if we rotate the text in a content cell, we see a second problem:

The text is not wrapped according to the shape of the cell.

For 90 degree rotations, we need to address both of these issues:

Translate the rotated text to the correct position inside the cell

Wrap the text according to the rotated dimensions

In the next post, we will look at the existing Prawn code, and come up with a plan of attack.