Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. chart.php
  2. <script>
  3. //<![CDATA[
  4. (function() {
  5. window.onload = function(){
  6. html2canvas(document.getElementById('chart'), {
  7. "onrendered": function(canvas) {
  8. var img = new Image();
  9. img.onload = function() {
  10. img.onload = null;
  11. console.log(canvas.toDataURL("image/png"));
  12. window.localStorage.setItem("imgURL", canvas.toDataURL("image/png"));
  13. };
  14. img.onerror = function() {
  15. img.onerror = null;
  16. if(window.console.log) {
  17. window.console.log("Not loaded image from canvas.toDataURL");
  18. } else {
  19. //alert("Not loaded image from canvas.toDataURL");
  20. }
  21. };
  22. img.src = canvas.toDataURL("image/png");
  23. }
  24. });
  25. };
  26. })();
  27. //]]>
  28. </script>
  29. <body>
  30. <a href="outputforcustomer.php" class="button">Report</a>
  31. <a href="pdfGen.php" disabled class="button">Download</a>
  32. ..more code to generate the chart
  33. </body>
  34.  
  35. <?php
  36. $pdf = new FPDF();
  37. $pdf->AddPage();
  38. //over here I want to add the image from the chart.php page whose data url is now in the localstorage.
  39. ..more code to generate report
  40. $pdf->output();
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement