So, I'm trying to embed a canvas PNG image into a PDF using the Shrimp gem. A Base64 string is generated using the canvas toDataURL () function. Since the image is only required in PDF, I try to avoid saving it to the server. Params [: base64string] is passed to the server correctly.
However i try to use
image = Prawn::Images::PNG.new(base64string)
to create an image, but I get the NoMethodError: undefined `unpack 'method for nil: NilClass.
Any ideas what I'm doing wrong or how should it be done right?
source
share