From: John Joyce Date: 2007-04-28T00:09:57+09:00 Subject: Re: Looking for thoughts and opinions on Ruport, and reporting in Ruby in general. On Apr 27, 2007, at 11:30 PM, Gregory Brown wrote: > On 4/27/07, John Joyce wrote: >> >> On Apr 27, 2007, at 10:59 PM, Gregory Brown wrote: >> > > This does often seem to be the case. Usually when that fails, I >> > change one word in my Ruport code to switch to HTML. If that >> doesn't >> > work, I switch to PDF but then I don't have CSS so I need to >> roll up >> > my sleeves a bit. (Getting Much Better though!) >> >> What do you mean by "... I don't have CSS..."?? > > Well the easiest way for me to make a formatted report from Ruport if > I get a 'But can I make that blue' comment is output vanilla HTML and > then tweak the CSS to do the formatting. > > However, if we need printable reports, I need to move to PDF stuff. > Ruport's support has gotten a lot better, we have a ton of helper > functions that provide in some cases simplified interfaces and in > other cases just delegators to PDF::Writer. > > So we have methods like these: > > * @add_text@ - adds text to your output > * @center_image_in_box@ - takes a path to an image file and centers it > within boundaries you specify > * @rounded_text_box@ - draw text surrounded by a rounded-corner box > * @watermark@ - places a centered watermark on each page of your > report > * @move_cursor@ - moves cursor specified number of units along the > y-axis > * @move_cursor_to@ - moves cursor to a specified location on the y- > axis > * @pad@ - adds a specified amount of space above and below some output > * @pad_top@ - adds a specified amount of space above some output > * @pad_bottom@ - adds a specified amount of space below some output > * @draw_table@ - uses PDF::SimpleTable to draw a table to output > * @horizontal_line@ - draw a horizontal line > * @vertical_line@ - draw a vertical line > * @left_boundary@ - get the left boundary of the page > * @right_boundary@ - get the right boundary of the page > * @top_boundary@ - get the top boundary of the page > * @bottom_boundary@ - get the bottom boundary of the page > * @cursor@ - get the current location of the cursor on the y-axis > * @draw_text@ - places text at a specified position on the page > > And it's up to us to make it look pretty. Compare these two > formatters, to see what I mean: > http://pastie.caboo.se/57062 > I got it. You mean you don't have CSS available to you for PDF files? Interesting. On OS X it is a built in facility to print to PDF. CSS does itself present some formatting options for printing but they're not well implemented everywhere. The scaling options should be sufficient to generate nicely printable documents generally. I'm sure you know that though. but ... When a boss asks for a pdf they want a pdf.