For some reason my Rails app that uses wicked_pdf gem to generates PDF files (a gem that uses the software wkhtmltopdf) is generating different PDF in development and production.
This is how it outputs in development, is almost fine: Click here to view.
This is how outputs in production, with a lot of errors: Click here to view.
The real difference in the system is that in development I use the wkhtmltopdf 0.9.9 in OSX. In production I use wkhtmltopdf 0.9.9 in Ubuntu. Once the Ubuntu Server 14.04 don't use X Server (and the wkhtmltopdf need it) I installed the Xorg and make the follow wrapper:
/usr/bin/wkhtmltopdf.sh
xvfb-run -a -s "-screen 0 1024x768x32" wkhtmltopdf "$@"
And the follow code in Rails initializers:
/config/initializers/wicked_pdf.rb
if Rails.env.production?
WickedPdf.config = {
:exe_path => '/usr/bin/wkhtmltopdf.sh'
}
else
WickedPdf.config = {
:exe_path => '/usr/local/bin/wkhtmltopdf'
}
end
And that's the controller code that I render the PDF:
render :pdf => "curriculum",
:template => 'kurrics/kurrics.pdf.erb',
:margin => { :top => 4, :bottom => 4, :left => 0, :right => 0 },
:encoding => "utf8",
:print_media_type => true
And if its needed, the PDF template layout:
https://gist.github.com/fschuindt/e173c05d0cc7378df105
I am pretty lost, any tip?