jquerycanvasjspdf

JSPDF - display hand signature from canvas


How can I get a hand drawn signature onto the PDF? I have a jquery mobile report which the customer signs at the end. After the signature is drawn on the canvas it is displayed back to the customer.

I am then converting the report to PDF using JSPdf. I am displaying text, tables, and a logo with no problem, but this signature thing has really stumped me. With a normal pic you just convert to a URI and the pic is displayed but all I am getting with the signature is the URI.

enter image description here


Solution

  • Use signaturepad.js jQuery plugin to generate base64 coded signature image. Use that code as image src in htmltopdf in jspdf

    signaturepad.js documentation