Permalink
Browse files

Support wicked_pdf

  • Loading branch information...
1 parent bad38c9 commit 3065eaa48745def59737f2c02d47d8a414746452 @camdez camdez committed Dec 21, 2011
Showing with 18 additions and 9 deletions.
  1. +18 −9 lib/wkhtmltopdf-heroku.rb
View
@@ -1,10 +1,19 @@
-# config/initializers/pdfkit.rb
-require 'pdfkit'
-PDFKit.configure do |config|
- config.wkhtmltopdf = File.expand_path "../../bin/wkhtmltopdf-linux-amd64", __FILE__
- # config.default_options = {
- # :page_size => 'Legal',
- # :print_media_type => true
- # }
- # config.root_url = "http://localhost" # Use only if your external hostname is unavailable on the server.
+WKHTMLTOPDF_PATH = File.expand_path "../../bin/wkhtmltopdf-linux-amd64", __FILE__
+
+begin
+ require 'pdfkit'
+
+ PDFKit.configure do |config|
+ config.wkhtmltopdf = WKHTMLTOPDF_PATH
+ end
+rescue LoadError
+ false
+end
+
+begin
+ require 'wicked_pdf'
+
+ WickedPdf.config[:exe_path] = WKHTMLTOPDF_PATH
+rescue LoadError
+ false
end

0 comments on commit 3065eaa

Please sign in to comment.