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;
304 file_put_contents($html_file, implode(
'', $job->getPages()));
305 $this->createPDFFileFromHTMLFile($html_file,
$config, $job);
313 public function createPDFFileFromHTMLFile($a_path_to_file,
$config, $job)
318 if (file_exists($a_path_to_file)) {
322 $return_value =
ilUtil::execQuoted(
$config[
'path'], $this->do_not_validate_ssl .
' ' . $this->path_to_rasterize .
' ' . $args);
324 $ilLog->write(
'ilPhantomJSRenderer command line config: ' . $args);
325 foreach ($return_value as
$key => $value) {
326 $ilLog->write(
'ilPhantomJSRenderer return value line ' .
$key .
' : ' . $value);
329 if (file_exists($temp_file)) {
330 $ilLog->write(
'ilPhantomJSRenderer file exists: ' . $temp_file .
' file size is :' . filesize($temp_file) .
' bytes, will be renamed to ' . $job->getFilename());
333 $ilLog->write(
'ilPhantomJSRenderer error: ' . print_r($return_value,
true));
365 $viewport->setInfo($this->lng->txt(
'viewport_info'));
375 if ($this->header_show_pages ==
true || $this->header_show_pages == 1) {
407 if ($this->footer_show_pages ==
true || $this->footer_show_pages == 1) {
441 $margin->setValue($this->margin);
478 if (strtoupper(substr(PHP_OS, 0, 3)) ===
'WIN' && $file_type ==
'html') {
479 return 'file:///' . str_replace(
':/',
'://',
ilUtil::ilTempnam()) .
'.' . $file_type;
496 'text' =>
$config[
'header_text'],
497 'height' =>
$config[
'header_height'],
498 'show_pages' =>
$config[
'header_show_pages']);
505 'text' =>
$config[
'footer_text'],
506 'height' =>
$config[
'footer_height'],
507 'show_pages' =>
$config[
'footer_show_pages']);
512 $r_config[
'page_size'] =
$config[
'page_size'];
513 $r_config[
'orientation'] =
$config[
'orientation'];
514 $r_config[
'margin'] =
$config[
'margin'];
515 $r_config[
'delay'] =
$config[
'javascript_delay'];
516 $r_config[
'viewport'] =
$config[
'viewport'];
517 $r_config[
'header'] = $h_config;
518 $r_config[
'footer'] = $f_config;
519 $r_config[
'page_type'] =
$config[
'page_type'];
521 return json_encode(json_encode($r_config));
buildJavascriptDelayForm()
This class represents an option in a radio group.
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
Create styles array
The data for the language used.
__construct($phpunit=false)
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
buildHeaderPageNumbersForm()
addConfigElementsToForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
buildFooterPageNumbersForm()
getCommandLineConfig($config)