Closed dcalixto closed 7 years ago
@dcalixto Sorry for late responce.
So in a controller you can do something like:
# GET /invoices/1
def show
respond_to do |format|
format.pdf {
@pdf = InvoicePDF.new(@invoice).render
send_data @pdf, type: 'application/pdf', disposition: 'inline'
}
end
end
and InvoicePDF object would then call InvoicePrinter:
require 'invoice_printer'
class InvoicePDF
include ActionView::Helpers::TranslationHelper
include InvoiceBar::InvoiceBarHelper
def initialize(invoice)
@invoice = invoice
end
def render
InvoicePrinter.render(
document: printable_invoice
)
end
I included an example to README: https://github.com/strzibny/invoice_printer#ruby-on-rails
Thanks for the feedback, closing now. Please continue if something is unclear.
generally with praw the pdf start with
and on pdf
include ActionView::Helpers::NumberHelper
but with invoice_printer did not start. thanks