class Parade::Commands::StaticPdf

Saves a PDF version of the presentation that is from the HtmlOutput

Public Instance Methods

default_pdf_output() click to toggle source
# File lib/parade/commands/static_pdf.rb, line 32
def default_pdf_output
  "presentation.pdf"
end
description() click to toggle source
# File lib/parade/commands/static_pdf.rb, line 11
def description
  "Output into a PDF format"
end
generate(options) click to toggle source
# File lib/parade/commands/static_pdf.rb, line 15
def generate(options)
  options.merge!('template' => 'pdf')

  html_generator = HtmlOutput.new
  html_content = html_generator.generate(options)

  kit = PDFKit.new(html_content,:page_size => 'Letter', :orientation => 'Landscape')

  output_file = options[:output] || default_pdf_output

  return if (File.exists?(output_file) and not options.key?(:force))

  kit.to_file(output_file)

  puts "Saved PDF to #{output_file}"
end