3require_once 
'./Services/PDFGeneration/classes/class.ilPDFGenerationConstants.php';
 
    4require_once 
'./Services/PDFGeneration/interfaces/interface.ilRendererConfig.php';
 
    5require_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);
 
  156        $op->addSubItem($header_select);
 
  164        $footer_select->setValue($this->footer_type);
 
  165        $op->addSubItem($footer_select);
 
  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);
 
  172        $form->addItem($item_group);
 
  189        $form->getItemByPostVar(
'path')->setValue(
$config[
'path']);
 
  190        $form->getItemByPostVar(
'page_size')->setValue(
$config[
'page_size']);
 
  191        $form->getItemByPostVar(
'margin')->setValue(
$config[
'margin']);
 
  192        $form->getItemByPostVar(
'javascript_delay')->setValue(
$config[
'javascript_delay']);
 
  193        $form->getItemByPostVar(
'viewport')->setValue(
$config[
'viewport']);
 
  194        $form->getItemByPostVar(
'orientation')->setValue(
$config[
'orientation']);
 
  195        $form->getItemByPostVar(
'header_select')->setValue(
$config[
'header_type']);
 
  196        $form->getItemByPostVar(
'header_text')->setValue(
$config[
'header_text']);
 
  197        $form->getItemByPostVar(
'header_height')->setValue(
$config[
'header_height']);
 
  198        $form->getItemByPostVar(
'header_show_pages')->setChecked(
$config[
'header_show_pages']);
 
  199        $form->getItemByPostVar(
'footer_select')->setValue(
$config[
'footer_type']);
 
  200        $form->getItemByPostVar(
'footer_text')->setValue(
$config[
'footer_text']);
 
  201        $form->getItemByPostVar(
'footer_height')->setValue(
$config[
'footer_height']);
 
  202        $form->getItemByPostVar(
'footer_show_pages')->setChecked(
$config[
'footer_show_pages']);
 
  203        $form->getItemByPostVar(
'page_type')->setValue(
$config[
'page_type']);
 
  237        $config[
'path'] =
$form->getItemByPostVar(
'path')->getValue();
 
  238        $config[
'page_size'] = 
$form->getItemByPostVar(
'page_size')->getValue();
 
  239        $config[
'margin'] =
$form->getItemByPostVar(
'margin')->getValue();
 
  240        $config[
'javascript_delay'] = 
$form->getItemByPostVar(
'javascript_delay')->getValue();
 
  241        $config[
'viewport'] = 
$form->getItemByPostVar(
'viewport')->getValue();
 
  242        $config[
'orientation'] = 
$form->getItemByPostVar(
'orientation')->getValue();
 
  243        $config[
'header_type'] = 
$form->getItemByPostVar(
'header_select')->getValue();
 
  244        $config[
'header_text'] = 
$form->getItemByPostVar(
'header_text')->getValue();
 
  245        $config[
'header_height']  = 
$form->getItemByPostVar(
'header_height')->getValue();
 
  246        $config[
'header_show_pages'] = 
$form->getItemByPostVar(
'header_show_pages')->getChecked();
 
  247        $config[
'footer_type'] = 
$form->getItemByPostVar(
'footer_select')->getValue();
 
  248        $config[
'footer_text'] = 
$form->getItemByPostVar(
'footer_text')->getValue();
 
  249        $config[
'footer_height'] = 
$form->getItemByPostVar(
'footer_height')->getValue();
 
  250        $config[
'footer_show_pages'] = 
$form->getItemByPostVar(
'footer_show_pages')->getChecked();
 
  251        $config[
'page_type'] = 
$form->getItemByPostVar(
'page_type')->getValue();
 
  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;
 
  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));
 
An exception for terminatinating execution or to throw for unit testing.
static rename($a_source, $a_target)
Rename a file.
static getPageSizesNames()
static setCheckedIfTrue(\ilPropertyFormGUI $form)
getDefaultConfig($service, $purpose)
from ilRendererConfig
buildJavascriptDelayForm()
populateConfigElementsInForm(\ilPropertyFormGUI $form, $service, $purpose, $config)
from ilRendererConfig
getTempFileName($file_type)
buildHeaderPageNumbersForm()
addConfigElementsToForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
validateConfigInForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
__construct($phpunit=false)
buildFooterPageNumbersForm()
getCommandLineConfig($config)
getConfigFromForm(\ilPropertyFormGUI $form, $service, $purpose)
from ilRendererConfig
generatePDF($service, $purpose, $config, $job)
from ilPDFRenderer
This class represents an option in a radio group.
This class represents a text property in a property form.
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.
if(isset($_POST['submit'])) $form