0

I have a complicated problem with creating zip file containing collection of active record object in pdf format.

I have invoices controller and in this controller I have action show which looks like this:

 def show
    add_breadcrumb "Inovice details"
    respond_to do |format|
      format.html
      format.pdf do
        render :pdf => "file_name"
      end
    end
  end

I generate pdf with wicked_pdf gem. And now my goal is to from selected collection get each of invoice generate pdf file from it and add it to the zip file. I don't have any idea where to start. Thanks in advance.

Mateusz Urbański
  • 7,352
  • 15
  • 68
  • 133
  • 1
    It's not exactly with wicked_pdf, but I think this may give you some clue: https://stackoverflow.com/questions/23284766/download-report-invoice-as-pdf-format-using-payday-gemfile-in-rails/23615766#23615766. I hope it helps. :) – Surya Sep 03 '14 at 13:47

1 Answers1

1

I just answered a very similar question here and included a test controller method that renders multiple multiple pdfs with wickedpdf and uses rubyzip to pack them together and send single archive.

generate ZIP from generated PDFs with wicked_pdf

Community
  • 1
  • 1
elc
  • 1,962
  • 20
  • 24