Class: BookChef::Compiler::PDF
- Inherits:
-
Object
- Object
- BookChef::Compiler::PDF
- Defined in:
- lib/bookchef/compilers/pdf.rb
Overview
Converts HTML into PDF using PDFKit
Instance Method Summary collapse
- #compile ⇒ Object
-
#initialize(html_input, options = {}) ⇒ PDF
constructor
A new instance of PDF.
Constructor Details
#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, = {}) @html_input = html_input = { output_file: "/tmp/output.pdf", footer_html_file: "#{BookChef::LIB_PATH}/templates/footer.html", footer_custom_html: "" } @options = .merge() @pdf = PDFKit.new( @html_input, enable_external_links: true, enable_internal_links: true, footer_html: @options[:temp_footer_filename] ) end |
Instance Method Details
#compile ⇒ Object
31 32 33 34 |
# File 'lib/bookchef/compilers/pdf.rb', line 31 def compile @pdf.to_file(@options[:output_file]) after_compile end |