Monday, June 29, 2015

jsPdf Print without browser history


<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>AngularJS Tutorial</title>
    <script src="//mrrio.github.io/jsPDF/dist/jspdf.debug.js"></script>
   <script type="text/javascript">

       function load() {

           var doc = new jsPDF();

           doc.setFontSize(12);
           doc.text(35, 25, "Welcome to JsPDF");
           doc.autoPrint();
           var string = doc.output('datauristring');
           
           var iframe = "<iframe width='100%' height='100%' src='" + string + "'></iframe>"

           var x = window.open();
           x.document.open();
           x.document.write(iframe);
           x.document.close();
          
       };
   </script>
</head>
<body >
    <input onclick="load()" type="button" value="click" />
</body>
</html>

No comments:

Post a Comment