json - How do I get codeIgniter 2, Bradley - SignaturePad and DomPDF to work correctly -


hello: using signaturepad [http://thomasjbradley.ca/lab/signature-pad/]and have created short web form in codeigniter 2, located here: [http://gentest.lfwebz.com/crd/open_form3], requires users sign form. have installed mpdf , dompdf , have them working, sort of, not quite way want to.

the functionality want this: user opens web form, fills out, signs it, using signpad mentioned above. want click button runs mpdf/dompdf , captures page , of course embedded signature.

when run mpdf/dompdf , pass view houses form, think have figured out grabbing fresh view, 1 without signature, several parts of form missing. after digging around, think have determined have use image conversion of signaturepad - stuck. have code in, using reference here: signature pad , dompdf, not work.

if go page here: http://gentest.lfwebz.com/crd/open_form3, sign page, click "i accept" button

here view

    <!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="../assets/jquery.signaturepad.css" media="screen"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script> <script type="text/javascript" src="../jquery.signaturepad.min.js"></script> </head> <body>     <?php echo base_url(); ?>     <form method="post" action="<?php echo base_url(); ?>pdf.php" class="sigpad">   <label for="name">print name</label>   <input type="text" name="name" id="name" class="name">   <p class="typeitdesc">review signature</p>   <p class="drawitdesc">draw signature</p>   <ul class="signav">     <li class="typeit"><a href="#type-it" class="current">type it</a></li>     <li class="drawit"><a href="#draw-it">draw it</a></li>     <li class="clearbutton"><a href="#clear">clear</a></li>   </ul>   <div class="sig sigwrapper">     <div class="typed"></div>     <canvas class="pad" width="198" height="55"></canvas>     <input type="text" name="output" class="output">     <input type="text" name="imgoutput" class="imgoutput">   </div>   <br /><br /><br />   <button type="submit">i accept terms of agreement.</button> </form> <script>   var sig;   $( document ).ready( function ( ) {     sig = $('.sigpad').signaturepad({defaultaction:'drawit'});   } );   $( '.sigpad' ).submit( function ( evt ) {     $( '.imgoutput' ).val( sig.getsignatureimage( ) );   } ); </script> </body> </html> 

here controller or pdf.php mentioned above:

<?php if(isset($_post['imgoutput'])){$img_output = $_post['imgoutput'];}  echo "position 1"; $bse = preg_replace('#^data:image/[^;]+;base64,#', '', $img_output ); echo "position 2"; echo $bse; if ( base64_encode( base64_decode( $bse) ) === $bse ) {    require_once 'dompdf/dompdf_config.inc.php';   $html = '<!doctype html><html><head></head><body><p>your signature:</p><br /><img src="'. $img_output .'"></body></html>';   $dompdf = new dompdf;   $dompdf->load_html( $html );   $dompdf->render( );   $dompdf->stream("test.pdf"); }          else{                 echo ("error !");             } ?> 

what missing here? please 1 point me in right direction?

let me know if need more info.

thank in advance.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -