3 require_once __DIR__ .
'/../class.ilAbstractHtmlToPdfTransformer.php';
4 require_once
'./Services/PDFGeneration/classes/class.ilPDFGenerationJob.php';
43 $output = preg_replace(
'#[\\\\/:*?"<>|]#',
'-', $output);
44 $output = $dir .
'/' . $output;
56 public function deliverPDFFromHTMLString($src, $output, $delivery_type,
$service, $purpose)
58 $map = ilPDFGeneratorUtils::getRendererMapForPurpose(
$service, $purpose);
59 $renderer = ilPDFGeneratorUtils::getRendererInstance($map[
'selected']);
60 $config = ilPDFGeneratorUtils::getRendererConfig(
$service, $purpose, $map[
'selected']);
62 if (basename($output) == $output) {
67 $job->setFilename($output);
69 $job->setOutputMode($delivery_type);
73 return $this->
deliverPDF($output, $delivery_type);
84 if (file_exists($file)) {
85 if (strtoupper($delivery_type) === self::PDF_OUTPUT_DOWNLOAD) {
87 } elseif (strtoupper($delivery_type) === self::PDF_OUTPUT_INLINE) {
89 } elseif (strtoupper($delivery_type) === self::PDF_OUTPUT_FILE) {
102 $tmp_file = dirname(reset($src)) .
'/complete_pages_overview.html';
105 if (file_exists($filename)) {
106 $html_content .= file_get_contents($filename);
109 file_put_contents($tmp_file, $html_content);
static makeDirParents($a_dir)
Create a new directory and all parent directories.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
Class ilPDFGenerationJob.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.