0

I have to print a page that contains a barcode as Pdf, for that, I generate my barcode div as canvas, then I convert it to an image and I add it to my pdf and it is printed in all the browsers, except in IE. My code is this:

<script type="text/javascript" src="/js/jquery/jquery-1.7.2.js"></script>
<script language=javascript src="/js/from_html.js"></script>
<script language=javascript  src="/js/jspdf.min.js"></script>
<script language=javascript src="/js/html2canvas.js"></script>
<script language=javascript src="/js/jquery-barcode.js"></script>

function getPdf(){
   var source = document.getElementById('Container');
html2canvas(source, {
        onrendered: function(canvas) {
            var imgData = canvas.toDataURL('image/png');              
            var doc = new jsPDF('p', 'mm');
            doc.addImage(imgData, 'PNG', 15, 10);
            doc.save('file.pdf');
        }
    });
}

I have these errors:

a) 'jsPDF is undefined' in ´from_html.js´ file

b) Expected ':' in jspdf.min.js file

can you see some error?

Pablo Glez
  • 306
  • 1
  • 7
  • 20
  • have you followed what was mentioned here https://stackoverflow.com/questions/16858954/how-to-properly-use-jspdf-library – securecodeninja Feb 16 '16 at 01:43
  • I started from there, but I needed to make some modifications, but still have the same problem with that methodology – Pablo Glez Feb 16 '16 at 16:19

0 Answers0