Module: BrInvoicesPdf::Util::PdfRenderer
- Extended by:
- BaseRenderer
- Included in:
- Cfe::Renderer, Nfce::Renderer
- Defined in:
- lib/br_invoices_pdf/util/pdf_renderer.rb
Constant Summary collapse
- AUTO_HEIGHT_MOCK =
2000
Constants included from BaseRenderer
BaseRenderer::CNPJ_FORMAT, BaseRenderer::CPF_FORMAT, BaseRenderer::PAYMENTS_TABLE_BASE_DATA
Class Method Summary collapse
-
.generate_pdf(data, options, renderers) ⇒ Object
:reek:FeatureEnvy.
- .pdf_content(pdf, data, options) ⇒ Object
Methods included from BaseRenderer
box, format_cnpj, format_cpf, format_currency, format_number, page_content_width, page_paper_width, pdf_setup
Class Method Details
.generate_pdf(data, options, renderers) ⇒ Object
:reek:FeatureEnvy
13 14 15 16 17 18 19 20 21 |
# File 'lib/br_invoices_pdf/util/pdf_renderer.rb', line 13 def generate_pdf(data, , renderers) page_width = Util::BaseRenderer.page_paper_width([:page_size]) data[:additional_variables] = [:additional_variables] || {} Prawn::Document.new(.merge(page_size: [page_width, AUTO_HEIGHT_MOCK])) do |pdf| pdf_content(pdf, data, page_width: page_width, renderers: renderers) end end |
.pdf_content(pdf, data, options) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/br_invoices_pdf/util/pdf_renderer.rb', line 23 def pdf_content(pdf, data, ) pdf.font_size(7) do [:renderers].each do |renderer| renderer.execute(pdf, data) end page = pdf.page page.dictionary.data[:MediaBox] = [0, pdf.y - page.margins[:bottom], [:page_width], AUTO_HEIGHT_MOCK] end end |