Sha256: a75edde898c93fe16a505dba0a39e642f62bcbc3d777b105674823f93272c2d4

Contents?: true

Size: 399 Bytes

Versions: 16

Compression:

Stored size: 399 Bytes

Contents

module BrInvoicesPdf
  class Generator
    PDF_OPTIONS = { page_size: 'A4', margin: [40, 75] }.freeze

    def initialize(renderer, parser)
      @renderer = renderer
      @parser = parser
    end

    def generate(xml, options)
      parsed_xml = Ox.parse(xml)
      data = @parser.parse(parsed_xml)
      opts = PDF_OPTIONS.merge(options)
      @renderer.pdf(data, opts).render
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.6 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.6.alpha.18 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.5.alpha.17 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.5 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.5.alpha.16 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.4 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.4.alpha.15 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.4.alpha.14 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.3 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.2 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.1 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.0 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.0.alpha.13 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.0.alpha.12 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.1.5.alpha.11 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.1.5.alpha.10 lib/br_invoices_pdf/generator.rb