Parent

Ezprint::Processors::Pdfkit

Public Class Methods

process(html_string, options = {}) click to toggle source
# File lib/ezprint/processors/pdfkit.rb, line 6
def self.process(html_string, options = {})
  stylesheets = options.delete(:stylesheets)
  kit = PDFKit.new(self.process_html(html_string), options)
  kit.stylesheets = stylesheets
  kit.to_pdf
end
process_html(html) click to toggle source
# File lib/ezprint/processors/pdfkit.rb, line 13
def self.process_html(html)
  # reroute absolute paths
  html.gsub!("src=\"/", "src=\"#{RAILS_ROOT}/public/")
  html.gsub!("href=\"/", "src=\"#{RAILS_ROOT}/public/")
  html.gsub!("url(/", "url(#{RAILS_ROOT}/public/")
  html
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.