Module: Postdoc

Defined in:
lib/postdoc.rb,
lib/postdoc/client.rb,
lib/postdoc/html_document.rb,
lib/postdoc/chrome_process.rb

Defined Under Namespace

Classes: ChromeProcess, Client, HTMLDocument

Class Method Summary collapse

Class Method Details

.render_from_string(content, **options) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/postdoc.rb', line 13

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