I have an evil pdf working in development and production. This is the core of my wicked_pdf configuration:
I updated the WickedPdfHelper (downloaded from initializers / wicked_pdf.rb) based on the wicked_pdf pull request from github antti user
module WickedPdfHelper
def wicked_pdf_stylesheet_link_tag(*sources)
sources.collect { |source|
"<style type='text/css'>#{Rails.application.assets.find_asset(source+".css")}</style>"
}.join("\n").html_safe
end
def wicked_pdf_image_tag(img, options={})
asset = Rails.application.assets.find_asset(img)
image_tag "file://#{asset.pathname.to_s}", options
end
def wicked_pdf_javascript_src_tag(jsfile, options={})
asset = Rails.application.assets.find_asset(jsfile)
javascript_include_tag "file://#{asset.pathname.to_s}", options
end
def wicked_pdf_javascript_include_tag(*sources)
sources.collect{ |source| "<script type='text/javascript'>#{Rails.application.assets.find_asset(source+".js")}</script>" }.join("\n").html_safe
end
end
then in app / assets / stylesheets / pdf.css I need some sass style sheets:
(remember that if you change the initializers or anything in config /, you need to re-run the rails application to make changes)