Class: ReportPdf
- Inherits:
-
Object
- Object
- ReportPdf
- Defined in:
- lib/query_report/report_pdf.rb
Instance Attribute Summary collapse
-
#default_options ⇒ Object
Returns the value of attribute default_options.
-
#pdf ⇒ Object
Returns the value of attribute pdf.
Instance Method Summary collapse
-
#initialize(report) ⇒ ReportPdf
constructor
A new instance of ReportPdf.
- #pdf_content(&code) ⇒ Object
- #render_header(options = {}) ⇒ Object
- #standard ⇒ Object
Constructor Details
#initialize(report) ⇒ ReportPdf
Returns a new instance of ReportPdf.
7 8 9 10 11 12 13 14 |
# File 'lib/query_report/report_pdf.rb', line 7 def initialize(report) @report = report self. = {alternate_row_bg_color: ["DDDDDD", "FFFFFF"], header_bg_color: 'AAAAAA', color: '000000', light_color: '555555'} self.pdf = Prawn::Document.new end |
Instance Attribute Details
#default_options ⇒ Object
Returns the value of attribute default_options.
5 6 7 |
# File 'lib/query_report/report_pdf.rb', line 5 def @default_options end |
#pdf ⇒ Object
Returns the value of attribute pdf.
5 6 7 |
# File 'lib/query_report/report_pdf.rb', line 5 def pdf @pdf end |
Instance Method Details
#pdf_content(&code) ⇒ Object
26 27 28 29 30 |
# File 'lib/query_report/report_pdf.rb', line 26 def pdf_content(&code) render_header code.call(pdf) pdf end |
#render_header(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/query_report/report_pdf.rb', line 16 def render_header(={}) #pdf.font("Times-Roman", size: 10) do # pdf.text_box current_institute.address.to_s, # :at => [400, pdf.cursor+20], # :inline_format => true, # :height => 100, # :width => 100 #end end |
#standard ⇒ Object
32 33 34 35 36 37 |
# File 'lib/query_report/report_pdf.rb', line 32 def standard pdf_content do render_charts_with @report render_table_with(@report.all_records, {font_size: 8, header_font_size: 10}) end end |