Class: FacturaePrint::Renderers::PDFRenderer
- Inherits:
-
Object
- Object
- FacturaePrint::Renderers::PDFRenderer
- Defined in:
- lib/facturae_print/renderers/pdf_renderer.rb
Instance Method Summary collapse
-
#initialize(template, invoice, args = {}) ⇒ PDFRenderer
constructor
A new instance of PDFRenderer.
- #render ⇒ Object
Constructor Details
#initialize(template, invoice, args = {}) ⇒ PDFRenderer
Returns a new instance of PDFRenderer.
7 8 9 10 11 12 |
# File 'lib/facturae_print/renderers/pdf_renderer.rb', line 7 def initialize(template, invoice, args={}) @template = template @invoice = invoice @stylesheet = args.delete(:stylesheet) @pdfkit_options = args end |
Instance Method Details
#render ⇒ Object
14 15 16 17 18 19 |
# File 'lib/facturae_print/renderers/pdf_renderer.rb', line 14 def render html = FacturaePrint::Renderers::HTMLRenderer.new(@template, @invoice).render append_stylesheet_tag(html, (@stylesheet.is_a?(IO) ? @stylesheet.read : @stylesheet)) if @stylesheet PDFKit.new(html, @pdfkit_options).to_pdf end |