Sha256: 327cce958cf790c150f363b9d40adcb6177986477ce1081af152a9e6576abe7b
Contents?: true
Size: 577 Bytes
Versions: 5
Compression:
Stored size: 577 Bytes
Contents
# frozen_string_literal: true require 'action_controller' require 'postdoc/chrome_process' require 'postdoc/client' require 'postdoc/html_document' module Postdoc ActionController::Renderers.add :pdf do |_filename, options| Postdoc.render_from_string render_to_string(options), options end def self.render_from_string(content, **options) server = ChromeProcess.new(**options) html_file = HTMLDocument.new(content, **options) server.client .print_pdf_from_html(html_file.path, **options) ensure server.kill html_file.cleanup end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
postdoc-0.3.7 | lib/postdoc.rb |
postdoc-0.3.6 | lib/postdoc.rb |
postdoc-0.3.5 | lib/postdoc.rb |
postdoc-0.3.4 | lib/postdoc.rb |
postdoc-0.3.3 | lib/postdoc.rb |