Class: Parade::Commands::StaticPdf
- Inherits:
-
Object
- Object
- Parade::Commands::StaticPdf
- Defined in:
- lib/parade/commands/static_pdf.rb
Overview
Saves a PDF version of the presentation that is from the HtmlOutput
Instance Method Summary collapse
Instance Method Details
#default_pdf_output ⇒ Object
32 33 34 |
# File 'lib/parade/commands/static_pdf.rb', line 32 def default_pdf_output "presentation.pdf" end |
#description ⇒ Object
11 12 13 |
# File 'lib/parade/commands/static_pdf.rb', line 11 def description "Output into a PDF format" end |
#generate(options) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/parade/commands/static_pdf.rb', line 15 def generate() .merge!('template' => 'pdf') html_generator = HtmlOutput.new html_content = html_generator.generate() kit = PDFKit.new(html_content,:page_size => 'Letter', :orientation => 'Landscape') output_file = [:output] || default_pdf_output return if (File.exists?(output_file) and not .key?(:force)) kit.to_file(output_file) puts "Saved PDF to #{output_file}" end |