This is an archived forum post. The information may be outdated. Contact us if you have any questions.
<?php require public_path().'/packages/pdfcrowd.php'; try { // create an API client instance $client = new Pdfcrowd("ME", "MYPASSWORD"); $client->setPageHeight("8.5in"); $client->setPageWidth("11in"); // convert a web page and store the generated PDF into a $pdf variable $pdf = $client->convertURI('http://blueskyengine.com/report/kitchen-solvers/114?do=makepdf'); // set HTTP response headers header("Content-Type: application/pdf"); header("Cache-Control: no-cache"); header("Accept-Ranges: none"); header("Content-Disposition: attachment; filename=\"Report.pdf\""); // send the generated PDF echo $pdf; } catch(PdfcrowdException $why) { echo "Pdfcrowd Error: " . $why; } ?>
<head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <style> td { width: 20px; height: 20px; } </style> </head> <body> <table> <tr> <td class="hilite"></td> <td class="hilite"></td> <td></td> <td></td> </tr> <tr> <td class="hilite"></td> <td class="hilite"></td> <td class="hilite"></td> <td></td> </tr> <tr> <td class="hilite"></td> <td class="hilite"></td> <td class="hilite"></td> <td class="hilite"></td> </tr> </table> <script> function getBackground(color) { var canvas = document.createElement('canvas'); canvas.width = 20; canvas.height = 20; var ctx = canvas.getContext("2d"); ctx.fillStyle = color; ctx.beginPath(); ctx.arc(10, 10, 7, 0, 2*Math.PI); ctx.fill(); return canvas.toDataURL(); } $(function() { var hiliteBackground = getBackground("#5888a0"); var greyBackground = getBackground("#e2e2e2"); $("td").css("background-image", "url(" + greyBackground + ")"); $(".hilite").css("background-image", "url(" + hiliteBackground + ")"); }); </script> </body>