lib/polish_invoicer/writer.rb in polish_invoicer-0.0.1 vs lib/polish_invoicer/writer.rb in polish_invoicer-0.0.2
- old
+ new
@@ -1,15 +1,16 @@
module PolishInvoicer
class Writer
attr_accessor :invoice, :template_path
- attr_accessor :logger, :wkhtmltopdf_command
+ attr_accessor :logger, :wkhtmltopdf_path, :wkhtmltopdf_command
def initialize(invoice)
@invoice = invoice
default_template_path = File.expand_path('../../../tpl/invoice.slim', __FILE__)
@template_path = @invoice.template_path || default_template_path
@logger = @invoice.logger
+ @wkhtmltopdf_path = @invoice.wkhtmltopdf_path
@wkhtmltopdf_command = @invoice.wkhtmltopdf_command
end
def save_to_html(path)
create_writer
@@ -22,9 +23,10 @@
end
protected
def create_writer
@writer = Slim2pdf::Writer.new(template_path)
+ @writer.wkhtmltopdf_path = wkhtmltopdf_path
@writer.wkhtmltopdf_command = wkhtmltopdf_command
@writer.logger = logger
data = @invoice.to_hash
@writer.data = data
@writer.footer_text = data[:footer]