1. Convert Prawn generated PDFs to an image with RMagick

    10 November 2010

    You’ll see some complaining from RMagick about how the Prawn generated PDF is not 100% up to Adobe standards but that can be ignored.


    pdf = Prawn::Document.new { text 'This is only a test.' }
    base64 = Base64.encode64(pdf.render)
    image = Magick::Image.read_inline(base64_pdf).first
    image.write('test.png')