Method: BookChef::Compiler::PDF#initialize

Defined in:
lib/bookchef/compilers/pdf.rb

#initialize(html_input, options = {}) ⇒ PDF

Returns a new instance of PDF.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/bookchef/compilers/pdf.rb', line 10

def initialize(html_input, options = {})
  
  @html_input = html_input
  default_options = {
    output_file:        "/tmp/output.pdf",
    footer_html_file:   "#{BookChef::LIB_PATH}/templates/footer.html",
    footer_custom_html: ""
  }
  @options = default_options.merge(options)

  create_footer

  @pdf = PDFKit.new(
    @html_input,
    enable_external_links: true,
    enable_internal_links: true,
    footer_html: @options[:temp_footer_filename]
  )

end