Class: Bidi2pdfRails::Services::HtmlToPdfConverter

Inherits:
Object
  • Object
show all
Includes:
Callbacks, PdfBrowserSession, PdfInjection
Defined in:
lib/bidi2pdf_rails/services/html_to_pdf_converter.rb

Instance Method Summary collapse

Methods included from Callbacks

#after_navigate, #after_print, #after_wait_for_tab, #before_navigate

Methods included from PdfInjection

#inject_custom_css, #inject_custom_js

Methods included from PdfBrowserSession

#run_browser_session

Constructor Details

#initialize(html, print_options: {}, wait_for_network_idle: true, wait_for_page_loaded: true, wait_for_page_check_script: nil, custom_css: nil, custom_css_url: nil, custom_js: nil, custom_js_url: nil, callbacks: nil) ⇒ HtmlToPdfConverter

Returns a new instance of HtmlToPdfConverter.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bidi2pdf_rails/services/html_to_pdf_converter.rb', line 10

def initialize(html, print_options: {}, wait_for_network_idle: true, wait_for_page_loaded: true, wait_for_page_check_script: nil, custom_css: nil, custom_css_url: nil, custom_js: nil, custom_js_url: nil, callbacks: nil)
  @html = html
  @print_options = print_options
  @wait_for_network_idle = wait_for_network_idle
  @wait_for_page_loaded = wait_for_page_loaded
  @wait_for_page_check_script = wait_for_page_check_script
  @custom_css = custom_css
  @custom_css_url = custom_css_url
  @custom_js = custom_js
  @custom_js_url = custom_js_url
  @callbacks = callbacks || {}
end

Instance Method Details

#generateObject



23
24
25
# File 'lib/bidi2pdf_rails/services/html_to_pdf_converter.rb', line 23

def generate
  run_browser_session
end