class Report
attr_reader :pdf
def to_pdf
Prawn::Document.new(page_layout: page_layout) do |pdf|
@pdf = pdf
pdf.repeat(:all) do
frame_page
end
pdf.repeat(:all) do
write_header
end
#write_section_divider
puts "wrote the header" #this is not getting hit
write_body
In my subclass:
def write_header
puts "Writing header"
pdf.move_down 8
pdf.text title, size: 22, style: :bold, align: :center
puts "wrote title"
pdf.bounding_box([0, pdf.cursor], width: pdf.bounds.right, height: 28) do
puts "bounding box"
pdf.move_down 8
pdf.text date_title, size: 16, align: :center
pdf.text current_day_title, size: 16, align: :center
puts "moved down"
end
puts "exited bounding box"
end
F, [2015-02-23T02:18:30.106303 #6] FATAL -- :
2015-02-23T02:18:30.106684+00:00 app[web.1]: app/reports/report.rb:6:in `to_pdf'
2015-02-23T02:18:30.106680+00:00 app[web.1]: app/reports/report.rb:13:in `block in to_pdf'
2015-02-23T02:18:30.106682+00:00 app[web.1]: app/reports/report.rb:6:in `new'
2015-02-23T02:18:30.106674+00:00 app[web.1]: Prawn::Errors::EmptyGraphicStateStack (
2015-02-23T02:18:30.106677+00:00 app[web.1]: You have reached the end of the graphic state stack):
2015-02-23T02:18:30.106690+00:00 app[web.1]:
2015-02-23T02:18:30.106691+00:00 app[web.1]:
2015-02-23T02:18:30.106688+00:00 app[web.1]: app/controllers/verified_return_money_reports_controller.rb:21:in `create'
2015-02-23T02:18:30.106687+00:00 app[web.1]: app/reports/verified_return_money_report.rb:6:in `to_pdf'
Why is my Prawn drawing failing?