Method: Postdoc::Client#print_pdf_from_html
- Defined in:
- lib/postdoc/client.rb
#print_pdf_from_html(file_path, settings: PrintSettings.new) ⇒ Object
We should move away from passing options like this and collect them in the prinbt settings.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/postdoc/client.rb', line 18 def print_pdf_from_html(file_path, settings: PrintSettings.new) client.send_cmd 'Page.enable' client.send_cmd 'Page.navigate', url: "file://#{file_path}" client.wait_for 'Page.loadEventFired' # prevent race condition sleep 0.1 if settings.slow_pc response = client.send_cmd 'Page.printToPDF', settings.to_cmd Base64.decode64 response['data'] end |