Background
I retrieved a pdf in binary form from an API call:
base_64_binary_data = @response_label[:generate_label_response][:response_shipments][:response_shipment][:labels][:label][:content]
@pdf_file = File.open('label.pdf', 'wb') do |file|
content = Base64.decode64 base_64_binary_data
file << content
end
The above code results in a file that I can look up and is the crystal clear image I need.
Issue
I need to place this image inside a view in order to function as a label on an invoice.
The following seems to be leading to a fine solution:
@pdf = MiniMagick::Image.new(@pdf_file.path)
@pdf.pages.first.write("preview.png")
It fails on the second line.
MiniMagick::Error
`identify label.pdf` failed with error:
...2nd line...
I'd like to work to something like this functioning: