3 require_once
'./Services/PDFGeneration/classes/class.ilPDFGenerationConstants.php';
4 require_once
'./Services/PDFGeneration/interfaces/interface.ilRendererConfig.php';
5 require_once
'./Services/PDFGeneration/interfaces/interface.ilPDFRenderer.php';
119 return $this->lng->txt(
'pdfgen_renderer_dummyrender_plugname');
139 $path->setValue($this->path);
144 $op =
new ilRadioOption($this->lng->txt(
'page'), self::PAGE);
155 $header_select->setValue($this->header_type);
164 $footer_select->setValue($this->footer_type);
166 $item_group->addOption($op);
168 $op =
new ilRadioOption($this->lng->txt(
'viewport'), self::VIEWPORT);
170 $item_group->addOption($op);
171 $item_group->setValue($this->page_type);
270 $config[
'path'] =
'/usr/local/bin/phantomjs';
275 $config[
'javascript_delay'] = 200;
277 $config[
'orientation'] =
'Portrait';
280 $config[
'header_height'] =
'0cm';
281 $config[
'header_show_pages'] = 0;
284 $config[
'footer_height'] =
'0cm';
285 $config[
'footer_show_pages'] = 0;
286 $config[
'page_type'] = self::PAGE;
322 file_put_contents($html_file, implode(
'', $job->getPages()));
323 $this->createPDFFileFromHTMLFile($html_file,
$config, $job);
331 public function createPDFFileFromHTMLFile($a_path_to_file,
$config, $job)
336 if (file_exists($a_path_to_file)) {
340 $return_value =
ilUtil::execQuoted(
$config[
'path'], $this->do_not_validate_ssl .
' ' . $this->path_to_rasterize .
' ' . $args);
342 $ilLog->write(
'ilPhantomJSRenderer command line config: ' . $args);
343 foreach ($return_value as
$key => $value) {
344 $ilLog->write(
'ilPhantomJSRenderer return value line ' .
$key .
' : ' . $value);
347 if (file_exists($temp_file)) {
348 $ilLog->write(
'ilPhantomJSRenderer file exists: ' . $temp_file .
' file size is :' . filesize($temp_file) .
' bytes, will be renamed to ' . $job->getFilename());
351 $ilLog->write(
'ilPhantomJSRenderer error: ' . print_r($return_value,
true));
383 $viewport->setInfo($this->lng->txt(
'viewport_info'));
393 if ($this->header_show_pages ==
true || $this->header_show_pages == 1) {
425 if ($this->footer_show_pages ==
true || $this->footer_show_pages == 1) {
459 $margin->setValue($this->margin);
496 if (strtoupper(substr(PHP_OS, 0, 3)) ===
'WIN' && $file_type ==
'html') {
497 return 'file:///' . str_replace(
':/',
'://',
ilUtil::ilTempnam()) .
'.' . $file_type;
514 'text' =>
$config[
'header_text'],
515 'height' =>
$config[
'header_height'],
516 'show_pages' =>
$config[
'header_show_pages']);
523 'text' =>
$config[
'footer_text'],
524 'height' =>
$config[
'footer_height'],
525 'show_pages' =>
$config[
'footer_show_pages']);
530 $r_config[
'page_size'] =
$config[
'page_size'];
531 $r_config[
'orientation'] =
$config[
'orientation'];
532 $r_config[
'margin'] =
$config[
'margin'];
533 $r_config[
'delay'] =
$config[
'javascript_delay'];
534 $r_config[
'viewport'] =
$config[
'viewport'];
535 $r_config[
'header'] = $h_config;
536 $r_config[
'footer'] = $f_config;
537 $r_config[
'page_type'] =
$config[
'page_type'];
539 return json_encode(json_encode($r_config));
buildJavascriptDelayForm()
This class represents an option in a radio group.
prepareGenerationRequest($service, $purpose)
Prepare the content processing at the beginning of a PDF generation request Should be used to initial...
getDefaultConfig($service, $purpose)
from ilRendererConfig
static getPageSizesNames()
getConfigFromForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
static rename($a_source, $a_target)
Rename a file.
getTempFileName($file_type)
static setCheckedIfTrue(\ilPropertyFormGUI $form)
if(isset($_POST['submit'])) $form
validateConfigInForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
generatePDF($service, $purpose, $config, $job)
from ilPDFRenderer
This class represents a text property in a property form.
populateConfigElementsInForm(\ilPropertyFormGUI $form, $service, $purpose, $config)
from ilRendererConfig
__construct($phpunit=false)
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
buildHeaderPageNumbersForm()
addConfigElementsToForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
static getInstance()
Singleton: get instance.
buildFooterPageNumbersForm()
const RENDER_SVG_AS_XML_EMBED
getCommandLineConfig($config)