Files
openfoodnetwork/config/initializers/wicked_pdf.rb
2022-09-15 12:12:47 +01:00

28 lines
728 B
Ruby

if Rails.env.test?
Rails.application.reloader.to_prepare do
WickedPdf.config = {
#:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
#:layout => "pdf.html",
:page_size => 'A3',
:exe_path => `bundle exec which wkhtmltopdf`.chomp
}
end
else
Rails.application.reloader.to_prepare do
WickedPdf.config = {
#:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',
#:layout => "pdf.html",
:page_size => 'A4', # default
:exe_path => `bundle exec which wkhtmltopdf`.chomp
}
end
end
# A monkey-patch to remove WickedPdf's monkey-patch, as it clashes with ViewComponents.
class WickedPdf
module PdfHelper
remove_method(:render)
remove_method(:render_to_string)
end
end