lib/pdfkit/configuration.rb in pdfkit-0.4.6 vs lib/pdfkit/configuration.rb in pdfkit-0.5.0
- old
+ new
@@ -1,22 +1,26 @@
class PDFKit
class Configuration
- attr_accessor :meta_tag_prefix, :wkhtmltopdf, :default_options
+ attr_accessor :meta_tag_prefix, :default_options
+ attr_writer :wkhtmltopdf
def initialize
@meta_tag_prefix = 'pdfkit-'
- @wkhtmltopdf = '/usr/local/bin/wkhtmltopdf'
@default_options = {
- :disable_smart_shrinking => true,
+ :disable_smart_shrinking => false,
:page_size => 'Letter',
:margin_top => '0.75in',
:margin_right => '0.75in',
:margin_bottom => '0.75in',
:margin_left => '0.75in',
:encoding => "UTF-8"
}
end
+
+ def wkhtmltopdf
+ @wkhtmltopdf ||= `which wkhtmltopdf`.chomp
+ end
end
class << self
attr_accessor :configuration
end
@@ -26,16 +30,14 @@
#
# @example
# PDFKit.configure do |config|
# config.wkhtmltopdf = '/usr/bin/wkhtmltopdf'
# end
-
+
def self.configuration
@configuration ||= Configuration.new
end
-
-
+
def self.configure
- self.configuration
yield(configuration)
end
-end
\ No newline at end of file
+end