In Rails I have correctly setup a view to display a captured signature using Signature Pad
I would now like to generate a pdf displaying the signature. The signature is json saved as a string in my postgresql db and as mentioned it will generate fine in a html view, the issue is generating in pdf.
I believe I have included the necessary assets correctly for wicked_pdf:
<%= wicked_pdf_stylesheet_link_tag "application" %>
<%= wicked_pdf_javascript_include_tag "application" %>
I have also tried to include the js directly in the pdf view:
<head>
<script>
function draw_signature() {
var sig = $('#signature').val();
if (typeof(sig) != 'undefined' || sig != null)
{
$('.sigPad').signaturePad({displayOnly:true}).regenerate(sig);
}
}
</script>
</head>
<body onload="draw_signature()">
<%= hidden_field_tag("signature", @customer.signature, :id => "signature") %>
<div class="sigPad signed">
<canvas class="pad" width="400" height="140"></canvas>
</div>