title: How to convert base64 string to PNG using Prawn without saving on server in Rails
body: <p>So I am trying to embed a PNG image of canvas to PDF using Prawn gem. Base64 string is generated by using canvas' toDataURL() function. As the image is only needed in PDF I'm trying to avoid saving it on the server. Params[:base64string] is correctly passed to the server.</p>
  
  <p>However, I am trying to use </p>
  
  <pre><code>image = Prawn::Images::PNG.new(base64string)
  </code></pre>
  
  <p>to create the image but I get NoMethodError: undefined method `unpack' for nil:NilClass. </p>
  
  <p>Any ideas what I'm doing wrong or how this should be done correctly? </p>