Skip to content

Instantly share code, notes, and snippets.

View simmogs's full-sized avatar

Graeme Simpson simmogs

View GitHub Profile
@simmogs
simmogs / wicked_pdf.rb
Created November 23, 2011 15:13 — forked from anlek/wicked_pdf.rb
Using Wicked_PDF with Rails 3.1
#in config/initializers/wicked_pdf.rb
module WickedPdfHelper
def wicked_pdf_stylesheet_link_tag(*sources)
sources.collect { |source|
"<style type='text/css'>#{Rails.application.assets.find_asset("#{source}.css").body}</style>"
}.join("\n").gsub(/url\(['"](.+)['"]\)(.+)/,%[url("#{wicked_pdf_image_location("\\1")}")\\2]).html_safe
end
def wicked_pdf_image_tag(img, options={})
image_tag wicked_pdf_image_location(img), options