2
votes

I have a functioning prawn document generated in rails. I built the table using text_box() to wrap the text in the header in order to rotate the text_box, and thus the text, 90 degrees. It works great, until the header reproduces on the next page...in which case the table header is intact but the text (inside the text_box()) is not reproduced because of how each text_box is positioned. Im wondering if anyone has a better idea for rotation the text so that it is simply in the table head. I couldn't get anything other than this method to produce what I want.

You can view my functioning PDF here...
http://flightrecord.herokuapp.com/vfrlarge.pdf?rating=6

The table data is quit extensive, so Im only gonna include how Im generating the table header:

def flights_table

table **flight_data_rows**, :width => 1200 do

self.header = true

def **flight_data_rows**
   y_pos = 518
  height = 500
       x = 155
    size = 7 
[[

text_box("Lesson", :at => [5, y_pos], :rotate => 90, :size => size), 
text_box("Date", :at => [24, y_pos+6], :size => size),                                 
text_box("CFI", :at => [66, y_pos+6], :size => size),                                  
text_box("N# / Type", :at => [109, y_pos+6], :size => size),                            
text_box("Total Time", :at => [x, y_pos],   :rotate => 90, :size => size, :width => 300),

]] +

@data.map do |data|
[
data.the_data,
data.the_data,
data.the_data,
data.the_data,
data.the_data
]
1
I came to this question only to see no solution! - Anwar

1 Answers

0
votes

This doesn't seem to be a viable option in prawn as of 1.0.0rc1. I tried many approaches, but none worked. I finally just removed the header row completely...in hopes of finishing this project later. I'll be giving wicked_pdf a shot.