This gem provides model responsible for generating pdf from html file.
- Add the following to your Gemfile
gem 'spree_invoice', '~> 1.1.0'
- Run
bundle install
- To copy and apply migrations run:
rails g spree_invoice:install
In file config/initializers/spree_invoice.rb please check your configuration for wkhtmltopdf bin path. For more see: wicked_pdf
- Print Invoice directly
Spree::Invoice.find_by_order_id('some id').try(:generate_pdf)
- Print Invoice from order
Order.last.invoice.generate_pdf
- Print Invoice from User
pdfs = [] User.last.invoices.each { |e| pdfs << e.generate_pdf }
You can also check how many times invoice was generated - column: counter
Copyright (c) 2012 [Damiano Giacomello], released under the New BSD License