示例#1
0
        $quexmlpdf->setBackgroundColourSection($_POST['backgroundColourSection']);
        $quexmlpdf->setSingleResponseAreaHeight($_POST['singleResponseAreaHeight']);
        $quexmlpdf->setSingleResponseHorizontalHeight($_POST['singleResponseHorizontalHeight']);
        $quexmlpdf->setQuestionnaireInfoMargin($_POST['questionnaireInfoMargin']);
        $quexmlpdf->setResponseLabelFontSize(array($_POST['responseLabelFontSize'], $_POST['responseLabelFontSizeSmall']));
    }
    $quexmlpdf->create($quexmlpdf->createqueXML(file_get_contents($filename)));
    //NEED TO GET QID from $quexmlpdf
    $qid = intval($quexmlpdf->getQuestionnaireId());
    $zip = new ZipArchive();
    $filename = tempnam("/tmp", "queXMLPDF") . ".zip";
    if ($zip->open($filename, ZIPARCHIVE::CREATE) !== TRUE) {
        exit("cannot open temporary file\n");
    }
    $zip->addFromString("quexf_banding_{$qid}.xml", $quexmlpdf->getLayout());
    $zip->addFromString("quexmlpdf_style_{$qid}.xml", $quexmlpdf->exportStyleXML());
    $zip->addFromString("quexmlpdf_{$qid}.pdf", $quexmlpdf->Output("quexml_{$qid}.pdf", 'S'));
    $zip->close();
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="quexmlpdf_' . $qid . '.zip"');
    header('Content-Transfer-Encoding: binary');
    // load the file to send:
    readfile($filename);
    unlink($filename);
} else {
    print_header("queXML Tools: Create PDF with banding XML for queXF from queXML");
    $quexmlpdf = new queXMLPDF(PDF_PAGE_ORIENTATION, 'mm', PDF_PAGE_FORMAT, true, 'UTF-8', false);
    ?>
	<h1>queXML to PDF and banding XML for queXF</h1>
	<p>If the file is valid queXML: a ZIP file containing a PDF and an XML file for banding using <a href='http://quexf.sourceforge.net'>queXF</a> will be returned</p>
	<br>