I would like to create 2 pdf documents from a single click.
I have it working with one file, but I can't seem to get to make 2 download files to happen w/out browser complaining about DoubleRenderError.
This is the code in my controller, where I am calling it twice and breaks. If I do it just once, everything works fine.
respond_to do |format|
format.pdf do
pdf = PrintCardsFront.new(paperSize, cardCount, @cards)
send_data pdf.render, filename: "cards_front_side.pdf", type: "application/pdf"
pdf = PrintCardsBack.new(paperSize, cardCount, @cards)
send_data pdf.render, filename: "cards_backside_side.pdf", type: "application/pdf"
end
end
(Rails 4.2)