Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chart.php
- <script>
- //<![CDATA[
- (function() {
- window.onload = function(){
- html2canvas(document.getElementById('chart'), {
- "onrendered": function(canvas) {
- var img = new Image();
- img.onload = function() {
- img.onload = null;
- console.log(canvas.toDataURL("image/png"));
- window.localStorage.setItem("imgURL", canvas.toDataURL("image/png"));
- };
- img.onerror = function() {
- img.onerror = null;
- if(window.console.log) {
- window.console.log("Not loaded image from canvas.toDataURL");
- } else {
- //alert("Not loaded image from canvas.toDataURL");
- }
- };
- img.src = canvas.toDataURL("image/png");
- }
- });
- };
- })();
- //]]>
- </script>
- <body>
- <a href="outputforcustomer.php" class="button">Report</a>
- <a href="pdfGen.php" disabled class="button">Download</a>
- ..more code to generate the chart
- </body>
- <?php
- $pdf = new FPDF();
- $pdf->AddPage();
- //over here I want to add the image from the chart.php page whose data url is now in the localstorage.
- ..more code to generate report
- $pdf->output();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement