Prawn: Turning Tables Part 1

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:

Default rotated text

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:

Rotate around specified

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

Rotate content

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

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

  1. Translate the rotated text to the correct position inside the cell
  2. 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.

Prawn: Turning Tables:

comments powered by Disqus