Sha256: 77a4d49e076447aa765218f10bd49da9dab51c28a7a94dc02be7ddac56c6c8bc
Contents?: true
Size: 600 Bytes
Versions: 1
Compression:
Stored size: 600 Bytes
Contents
require 'pdfkit' module Ezprint module Processors class Pdfkit < Base 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 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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ezprint-0.3.1 | lib/ezprint/processors/pdfkit.rb |