コード例 #1
0
    $productDiameter = $apiRequests->getProduct($productId)[0][D_diametro];
    $numPages = count($apiRequests->getViews($_GET['IDcus']));
    $pageWidth = 450;
    // 600 * 72 / 96
    $pageHeight = (int) $apiRequests->getCustomization($_GET['IDcus'])[0]['Height'] * 72 / 96;
    //pixels to points conversion
    if ($realSize == true) {
        if ($productWidth !== null && $productHeight !== null && $productDiameter == null || $productWidth == null && $productHeight == null && $productDiameter !== null) {
            $scaleFactor = floatval($productWidth / 158.75);
            // 600 pixles * 72 / 96 => becomes points then 1 pint is 0.35 mm => therefor 600px are 158.75 mm in 72 pixels per inch
            $pageWidth = str_replace('.00', $productUnits, $productWidth);
            $pageHeight = -1;
            $pdf = $client->setPdfScalingFactor($scaleFactor);
        } else {
            exit;
        }
    }
    $pdf = $client->setPageWidth($pageWidth);
    $pdf = $client->setPageHeight($pageHeight);
    $pdf = $client->setPageMargins(0, 0, 0, 0);
    $pdf = $client->setMaxPages($numPages);
    $pdf = $client->convertURI('http://www.sellosyrotulos.com/pdf_custom.php?IDcus=' . $idCus . '&type=' . $type);
    header('Content-Type: application/pdf');
    header('Cache-Control: no-cache');
    header('Accept-Ranges: none');
    header('Content-Disposition: attachment; filename=\'custom-' . $idCus . '.pdf\'');
    echo $pdf;
} catch (PdfcrowdException $e) {
    echo 'Pdfcrowd Error: ' . $e->getMessage();
}
//}
コード例 #2
0
ファイル: dashboards.php プロジェクト: redsummit/anitaborg
    $chart = '';
}
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) {