Module: Dorsale::Alexandrie::Prawn::RenderWithAttachments

Included in:
BillingMachine::InvoiceSingleVatPdf
Defined in:
app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb

Instance Method Summary collapse

Instance Method Details

#render_with_attachmentsObject



2
3
4
5
6
7
8
9
10
11
12
# File 'app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb', line 2

def render_with_attachments
  final_pdf = ::CombinePDF.parse(self.render)

  attachments.each do |attachment|
    next unless File.extname(attachment.file.path) == ".pdf"

    final_pdf << ::CombinePDF.load(attachment.file.path)
  end

  final_pdf.to_pdf
end