This module provides tools to simplify some common drawing operations. It is included by default in the PDF formatter.
Alias for PDF::Writer#absolute_bottom_margin
# File lib/ruport/formatter/pdf.rb, line 345 def bottom_boundary pdf_writer.absolute_bottom_margin end
Alias for PDF::Writer#y
# File lib/ruport/formatter/pdf.rb, line 350 def cursor pdf_writer.y end
Draws text at an absolute location, defined by :y, :x1|:left, :x2|:right
All options to add_text are also supported.
# File lib/ruport/formatter/pdf.rb, line 358 def draw_text(text,text_opts) ypos = cursor move_cursor_to(text_opts[:y]) if text_opts[:y] add_text(text, text_opts.merge(:absolute_left => text_opts[:x1] || text_opts[:left], :absolute_right => text_opts[:x2] || text_opts[:right])) move_cursor_to(ypos) end
Draws text at an absolute location, defined by :y, :x1|:left
The x position defaults to the left margin and the y position defaults to the current cursor location.
Uses PDF::Writer#add_text, so it will ignore any options not supported by that method.
# File lib/ruport/formatter/pdf.rb, line 375 def draw_text!(text,text_opts) ypos = cursor pdf_writer.add_text(text_opts[:x1] || text_opts[:left] || left_boundary, text_opts[:y] || ypos, text, text_opts[:font_size], text_opts[:angle] || 0) move_cursor_to(ypos) end
# File lib/ruport/formatter/pdf.rb, line 385 def finalize render_pdf end
Draws a horizontal line from x1 to x2
# File lib/ruport/formatter/pdf.rb, line 311 def horizontal_line(x1,x2) pdf_writer.line(x1,cursor,x2,cursor) pdf_writer.stroke end
Draws a horizontal line from #left_boundary to #right_boundary
# File lib/ruport/formatter/pdf.rb, line 317 def horizontal_rule horizontal_line(left_boundary,right_boundary) end
Alias for PDF::Writer#absolute_left_margin
# File lib/ruport/formatter/pdf.rb, line 330 def left_boundary pdf_writer.absolute_left_margin end
Alias for PDF::Writer#absolute_right_margin
# File lib/ruport/formatter/pdf.rb, line 335 def right_boundary pdf_writer.absolute_right_margin end
Alias for PDF::Writer#absolute_top_margin
# File lib/ruport/formatter/pdf.rb, line 340 def top_boundary pdf_writer.absolute_top_margin end
Draws a vertical line at x from y1 to y2
# File lib/ruport/formatter/pdf.rb, line 324 def vertical_line_at(x,y1,y2) pdf_writer.line(x,y1,x,y2) pdf_writer.stroke end