/** * Creates pdf in target directory * * @param core_kernel_classes_Resource $test * @param string $targetFolder path * @param boolean $force force the generation from new data * * @return string path to file */ public static function generatePdf(core_kernel_classes_Resource $test, $targetFolder) { $tmpFile = $targetFolder . 'test.pdf'; $url = tao_helpers_Uri::url('render', 'PrintTest', 'taoBooklet', array('uri' => $test->getUri(), 'force' => true)); $exporter = new PdfBookletExporter($test->getLabel()); $exporter->setContent($url); $exporter->saveAs($tmpFile); return $tmpFile; }
<?php /** * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; under version 2 * of the License (non-upgradable). * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2015 (original work) Open Assessment Technologies SA; * * */ use oat\taoBooklet\model\export\PdfBookletExporter; $guessPath = PdfBookletExporter::guessWhereWkhtmltopdfInstalled(); /** * Configuration for wkhtmltopdf tool */ return array('binary' => $guessPath ? $guessPath : 'wkhtmltopdf', 'options' => array('footer-font-size' => 8, 'footer-font-name' => 'optima', 'footer-right' => "[page] / [topage]", 'footer-left' => "Built with TAO", 'footer-center' => 'www.taotesting.com', 'header-font-size' => 8, 'header-font-name' => 'optima'));