Permalink
Browse files

Merge pull request #112 from kdmsnr/pdf_options

use showoff.json to set PDFKit options
  • Loading branch information...
2 parents 335e142 + 9aba465 commit 6e4c69686c3d169ebf512d202f03942b4a2603a4 @goncalossilva goncalossilva committed Nov 17, 2011
Showing with 11 additions and 1 deletion.
  1. +1 −1 lib/showoff.rb
  2. +10 −0 lib/showoff_utils.rb
View
@@ -387,7 +387,7 @@ def pdf(static=true)
# PDFKit.new takes the HTML and any options for wkhtmltopdf
# run `wkhtmltopdf --extended-help` for a full list of options
- kit = PDFKit.new(html, :page_size => 'Letter', :orientation => 'Landscape')
+ kit = PDFKit.new(html, ShowOffUtils.showoff_pdf_options)
# Save the PDF to a file
file = kit.to_file('/tmp/preso.pdf')
View
@@ -282,6 +282,16 @@ def self.showoff_title(dir = '.')
end
end
+ def self.showoff_pdf_options(dir = '.')
+ index = File.join(dir, ShowOffUtils.presentation_config_file )
+ order = nil
+ if File.exists?(index)
+ data = JSON.parse(File.read(index))
+ data.is_a?(Hash) && data['pdf_options'] || {:page_size => 'Letter',
+ :orientation => 'Landscape'}
+ end
+ end
+
EXTENSIONS = {
'pl' => 'perl',
'rb' => 'ruby',

0 comments on commit 6e4c696

Please sign in to comment.