Exemple #1
0
if (isset($_REQUEST['org'])) {
    $org = $_REQUEST['org'];
    $action = $_REQUEST['action'];
    $_SESSION['org'] = $org;
    $entry = $tc->getEntry($org);
    $results = $tc->getResponses($entry);
    $_SESSION['orgentry'] = $entry;
    $_SESSION['orgdata'] = $results;
    if ($action == 'pdf') {
        try {
            // create an API client instance
            $client = new Pdfcrowd("parkwalker", "96cda0de82cbabba37c86a38f2aaeba0");
            // $client = new Pdfcrowd("redsummit", "9eabc3fd96e21622fb581f8b42575587");
            $client->setPageWidth("11in");
            $client->setPageHeight("8.5in");
            $client->setHorizontalMargin("0.25in");
            $client->setVerticalMargin("0.25in");
            //$client->setHtmlZoom(400)
            $filename = $entry->Account->Name . '-Dashboard';
            // convert a web page and store the generated PDF into a $pdf variable
            $pdf = $client->convertURI("http://www.anitaborg.org/TCTest/dashboards.php?org={$org}&chart=00&action=convert");
            // set HTTP response headers
            header("Content-Type: application/pdf");
            header("Cache-Control: no-cache");
            header("Accept-Ranges: none");
            header("Content-Disposition: attachment; filename=\"{$filename}.pdf\"");
            // send the generated PDF
            echo $pdf;
        } catch (PdfcrowdException $e) {
            echo "Pdfcrowd Error: " . $e->getMessage();
        }