Sha256: 36a1a1430c1f970d27a6b0654db2dfa9c4e940d37c826cf2abf71645dbea8db9
Contents?: true
Size: 600 Bytes
Versions: 2
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.public_path}/") html.gsub!("href=\"/", "src=\"#{Rails.public_path}/") html.gsub!("url(/", "url(#{Rails.public_path}/") html end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ezprint-1.0.1 | lib/ezprint/processors/pdfkit.rb |
ezprint-1.0.0 | lib/ezprint/processors/pdfkit.rb |