Sha256: 2135626861cccfd8db9c2420f91e61d8e08b09a8669a4e431e82eb9adaf763c0

Contents?: true

Size: 430 Bytes

Versions: 23

Compression:

Stored size: 430 Bytes

Contents

# frozen_string_literal: true

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

23 entries across 23 versions & 1 rubygems

Version Path
br_invoices_pdf-0.2.8 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.7 lib/br_invoices_pdf/generator.rb
br_invoices_pdf-0.2.6.alpha.19 lib/br_invoices_pdf/generator.rb