Module: Bidi2pdfRails::Services::Callbacks

Included in:
HtmlToPdfConverter, UrlToPdfConverter
Defined in:
lib/bidi2pdf_rails/services/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#after_navigate(url_or_content, browser_tab) ⇒ Object



10
11
12
# File 'lib/bidi2pdf_rails/services/callbacks.rb', line 10

def after_navigate(url_or_content, browser_tab)
  @callbacks[:after_navigate]&.call(url_or_content, browser_tab)
end

#after_print(url_or_content, browser_tab, binary_pdf_content) ⇒ Object



18
19
20
21
22
# File 'lib/bidi2pdf_rails/services/callbacks.rb', line 18

def after_print(url_or_content, browser_tab, binary_pdf_content)
  return binary_pdf_content unless @callbacks[:after_print] # important to return the binary content if no callback is provided

  @callbacks[:after_print].call(url_or_content, browser_tab, binary_pdf_content)
end

#after_wait_for_tab(url_or_content, browser_tab) ⇒ Object



14
15
16
# File 'lib/bidi2pdf_rails/services/callbacks.rb', line 14

def after_wait_for_tab(url_or_content, browser_tab)
  @callbacks[:after_wait_for_tab]&.call(url_or_content, browser_tab)
end

#before_navigate(url_or_content, browser_tab) ⇒ Object



6
7
8
# File 'lib/bidi2pdf_rails/services/callbacks.rb', line 6

def before_navigate(url_or_content, browser_tab)
  @callbacks[:before_navigate]&.call(url_or_content, browser_tab)
end