Generating a PDF With Images from Base64 with Prawn
I am trying to save multiple pngs in one pdf. I'm receiving the PNGs from an API Call to the Endicia Label Server, which is giving me a Base64 Encoded Image as response. Based on this Question: How to convert base64 string to PNG using Prawn without saving on server in Rails def batch_order_labels @orders = Spree::Order.ready_to_ship.limit(1) dt = Date.current.strftime("%d %b %Y ") title = "Labels - #{dt} - #{@orders.count} Orders" Prawn::Document.generate("#{title}.pdf") do |pdf| @orders.each do |order| label = order.generate_label if order.international? @image = label.response_body.scan(/