Sha256: 27597c44815924bf681ab621b761eeae81d5edbab1cbd80956e83c1fba884901

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

require_relative 'html_output'

module Parade
  module Commands

    #
    # Saves a PDF version of the presentation that is from the HtmlOutput
    # 
    class StaticPdf

      def description
        "Output into a PDF format"
      end

      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

      def default_pdf_output
        "presentation.pdf"
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
parade-0.9.0 lib/parade/commands/static_pdf.rb
parade-0.8.2 lib/parade/commands/static_pdf.rb
parade-0.8.1 lib/parade/commands/static_pdf.rb
parade-0.8.0 lib/parade/commands/static_pdf.rb