downloadify.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!doctype>
  2. <html>
  3. <head>
  4. <title>jsPDF</title>
  5. <link rel="stylesheet" type="text/css" href="css/main.css">
  6. <script type="text/javascript" src="../libs/base64.js"></script>
  7. <script type="text/javascript" src="../jspdf.js"></script>
  8. <script type="text/javascript" src="../libs/downloadify/js/swfobject.js"></script>
  9. <script type="text/javascript" src="../libs/downloadify/js/downloadify.min.js"></script>
  10. </head>
  11. <body onload="load()">
  12. <h1>jsPDF Downloadify Example</h1>
  13. <p>This is an example of jsPDF using <a href="https://github.com/dcneiner/Downloadify">Downloadify</a>. This works in all major browsers.</p>
  14. <p id="downloadify">
  15. You must have Flash 10 installed to download this file.
  16. </p>
  17. <script type="text/javascript">
  18. function load(){
  19. Downloadify.create('downloadify',{
  20. filename: 'Example.pdf',
  21. data: function(){
  22. var doc = new jsPDF();
  23. doc.text(20, 20, 'PDF Generation using client-side Javascript');
  24. doc.addPage();
  25. doc.text(20, 20, 'Do you like that?');
  26. return doc.output();
  27. },
  28. onComplete: function(){ alert('Your File Has Been Saved!'); },
  29. onCancel: function(){ alert('You have cancelled the saving of this file.'); },
  30. onError: function(){ alert('You must put something in the File Contents or there will be nothing to save!'); },
  31. swf: '../libs/downloadify/media/downloadify.swf',
  32. downloadImage: '../libs/downloadify/images/download.png',
  33. width: 100,
  34. height: 30,
  35. transparent: true,
  36. append: false
  37. });
  38. }
  39. </script>
  40. </body>
  41. </html>