class BookChef::Compiler::PDF
Public Class Methods
new(html_input, options = {})
click to toggle source
# 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
Public Instance Methods
compile()
click to toggle source
# File lib/bookchef/compilers/pdf.rb, line 31 def compile @pdf.to_file(@options[:output_file]) after_compile end
Private Instance Methods
after_compile()
click to toggle source
# File lib/bookchef/compilers/pdf.rb, line 53 def after_compile File.unlink(@options[:temp_footer_filename]) if File.exists?(@options[:footer_html_file]) end