As weird as it may sound, the code that generated pdf using Prawn gem in my local version worked successfully, while in online version it shows nothing but empty pdf page. I have also tried changing the environment to “production” in my local version but still unable to reproduce this issue.
The code I use to generate that pdf was:
write_attribute(:filepath, "/reports/#{self.publisher.email}/#{Time.now.to_s(:report_filename)}.#{self.format}")
Prawn::Document.generate(RAILS_ROOT + self.filepath) do |pdf|
titles = self.display_titles
items = self.display_items.map do |item|
titles.collect { |title| item[title.gsub(' ', '')].to_s }
end
pdf.table items, :border_style => :grid,
:row_colors => ["FFFFFF", "DDDDDD"],
:headers => titles,
:align => self.table_aligns
end
Can anybody help, please?
update 1
Running gem list prawn in local version gave me this:
*** LOCAL GEMS ***
prawn (0.8.4)
prawn-core (0.8.4)
prawn-layout (0.8.4)
prawn-security (0.8.4)
While running it online gave me:
*** REMOTE GEMS ***
prawn (0.8.4)
prawn-blank (0.0.1)
prawn-core (0.8.4)
prawn-fast-png (0.2.3)
prawn-flexible-table (0.1.2)
prawn-format (0.2.3)
prawn-graph (0.0.4)
prawn-js (0.7.1)
prawn-layout (0.8.4)
prawn-security (0.8.4)
prawn-svg (0.9.1.10)
prawn_commander (0.1.2)
prawn_rails (0.0.4)
prawnto (0.0.3)
Is it a clue to anything at all?
As a friend pointed out, Prawn does not like being Frozen Prawn. Install the gem with sudo to ensure it works.