Skip to content

Commit

Permalink
make executable flexible to adjust for non-standard install locations
Browse files Browse the repository at this point in the history
  • Loading branch information
grosser committed Jul 20, 2010
1 parent a9d68cb commit 84ff409
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/pdfkit/pdfkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def initialize(url_file_or_html, options = {})
end

def command
args = [PDFKit.configuration.wkhtmltopdf]
args = [executable]
args += @options.to_a.flatten.compact
args << '--quiet'

Expand All @@ -42,6 +42,16 @@ def command
args << '-' # Read PDF from stdout
args
end

def executable
default = PDFKit.configuration.wkhtmltopdf
return default if default !~ /^\// # its not a path, so nothing we can do
if File.exist?(default)
default
else
default.split('/').last
end
end

def to_pdf
append_stylesheets
Expand Down

0 comments on commit 84ff409

Please sign in to comment.