ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilWkhtmlToPdfConfig.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  private const ENABLE_QUIET = true;
27 
28  protected bool $phpunit = false;
29  protected array $config = [];
30  protected float $zoom = 1.0;
31  protected bool $external_links = false;
32  protected bool $enabled_forms = false;
33  protected bool $greyscale = false;
34  protected bool $low_quality = false;
35  protected string $orientation = 'Portrait';
36  protected bool $print_media_type = false;
37  protected string $page_size = 'A4';
38  protected int $javascript_delay = 100;
39  protected string $margin_left = '';
40  protected string $margin_right = '';
41  protected string $margin_top = '';
42  protected string $margin_bottom = '';
43  protected int $header_type = 0;
44  protected string $header_text_left = '';
45  protected string $header_text_center = '';
46  protected string $header_text_right = '';
47  protected int $header_text_spacing = 0;
48  protected bool $header_text_line = false;
49  protected string $header_html = '';
50  protected int $header_html_spacing = 0;
51  protected bool $header_html_line = false;
52  protected int $footer_type = 0;
53  protected string $footer_text_left = '';
54  protected string $footer_text_center = '';
55  protected string $footer_text_right = '';
56  protected int $footer_text_spacing = 0;
57  protected bool $footer_text_line = false;
58  protected string $footer_html = '';
59  protected int $footer_html_spacing = 0;
60  protected bool $footer_html_line = false;
61  protected string $checkbox_svg = '';
62  protected string $checkbox_checked_svg = '';
63  protected string $radio_button_svg = '';
64  protected string $radio_button_checked_svg = '';
65  protected string $path = '';
66  protected string $overwrite_default_font = 'arial';
67 
71  public function __construct($config = null)
72  {
73  if (is_array($config)) {
74  $this->readConfigFromArray($config);
75  } elseif ($config instanceof self) {
76  $this->readConfigFromObject($config);
77  } else {
78  $this->useDefaultConfig();
79  }
80  }
81 
82  protected function readConfigFromArray(array $config): void
83  {
84  $this->setKeyIfExists('setZoom', 'zoom', $config);
85  $this->setKeyIfExists('setEnabledForms', 'enable_forms', $config);
86  $this->setKeyIfExists('setExternalLinks', 'external_links', $config);
87  $this->setKeyIfExists('setLowQuality', 'low_quality', $config);
88  $this->setKeyIfExists('setGreyscale', 'greyscale', $config);
89  $this->setKeyIfExists('setOrientation', 'orientation', $config);
90  $this->setKeyIfExists('setPageSize', 'page_size', $config);
91  $this->setKeyIfExists('setMarginLeft', 'margin_left', $config);
92  $this->setKeyIfExists('setMarginRight', 'margin_right', $config);
93  $this->setKeyIfExists('setFooterHtmlSpacing', 'footer_html_spacing', $config);
94  $this->setKeyIfExists('setFooterHtml', 'footer_html', $config);
95  $this->setKeyIfExists('setFooterTextLine', 'footer_text_line', $config);
96  $this->setKeyIfExists('setFooterTextCenter', 'footer_text_center', $config);
97  $this->setKeyIfExists('setFooterTextCenter', 'footer_text_center', $config);
98  $this->setKeyIfExists('setFooterTextSpacing', 'footer_text_spacing', $config);
99  $this->setKeyIfExists('setFooterTextRight', 'footer_text_right', $config);
100  $this->setKeyIfExists('setFooterTextLeft', 'footer_text_left', $config);
101  $this->setKeyIfExists('setFooterType', 'footer_select', $config);
102  $this->setKeyIfExists('setHeaderHtmlSpacing', 'head_html_spacing', $config);
103  $this->setKeyIfExists('setHeaderHtmlLine', 'head_html_line', $config);
104  $this->setKeyIfExists('setHeaderHtml', 'head_html', $config);
105  $this->setKeyIfExists('setHeaderTextLine', 'head_text_line', $config);
106  $this->setKeyIfExists('setHeaderTextSpacing', 'head_text_spacing', $config);
107  $this->setKeyIfExists('setHeaderTextRight', 'head_text_right', $config);
108  $this->setKeyIfExists('setHeaderTextCenter', 'head_text_center', $config);
109  $this->setKeyIfExists('setHeaderTextLeft', 'head_text_left', $config);
110  $this->setKeyIfExists('setHeaderType', 'header_select', $config);
111  $this->setKeyIfExists('setRadioButtonCheckedSvg', 'radio_button_checked_svg', $config);
112  $this->setKeyIfExists('setRadioButtonSvg', 'radio_button_svg', $config);
113  $this->setKeyIfExists('setCheckboxCheckedSvg', 'checkbox_checked_svg', $config);
114  $this->setKeyIfExists('setCheckboxSvg', 'checkbox_svg', $config);
115  $this->setKeyIfExists('setJavascriptDelay', 'javascript_delay', $config);
116  $this->setKeyIfExists('setPrintMediaType', 'print_media_type', $config);
117  $this->setKeyIfExists('setMarginTop', 'margin_top', $config);
118  $this->setKeyIfExists('setMarginBottom', 'margin_bottom', $config);
119  $this->setKeyIfExists('setOverwriteDefaultFont', 'overwrite_font', $config);
120  }
121 
128  protected function setKeyIfExists(string $function, string $key, array $config): void
129  {
130  if (array_key_exists($key, $config)) {
131  $value = $config[$key];
132 
133  if (is_scalar($value)) {
134  $reflMethod = new ReflectionMethod($this, $function);
135  $type = $reflMethod->getParameters()[0]->getType();
136  if ($type instanceof ReflectionNamedType && $type->isBuiltin()) {
137  settype($value, $type->getName());
138  }
139  }
140  if ($value != null) {
141  $this->{$function}($value);
142  }
143  }
144  }
145 
146  protected function readConfigFromObject(ilWkhtmlToPdfConfig $config): void
147  {
148  $this->setZoom($config->getZoom());
149  $this->setEnabledForms($config->getEnabledForms());
150  $this->setExternalLinks($config->getExternalLinks());
151  $this->setLowQuality($config->getLowQuality());
152  $this->setGreyscale($config->getGreyscale());
153  $this->setOrientation($config->getOrientation());
154  $this->setPageSize($config->getPageSize());
155  $this->setMarginLeft($config->getMarginLeft());
156  $this->setMarginRight($config->getMarginRight());
157  $this->setFooterTextLine($config->isFooterTextLine());
158  $this->setFooterTextCenter($config->getFooterTextCenter());
159  $this->setFooterTextSpacing($config->getFooterTextSpacing());
160  $this->setFooterTextRight($config->getFooterTextRight());
161  $this->setFooterTextLeft($config->getFooterTextLeft());
162  $this->setFooterType($config->getFooterType());
163 
164  $this->setFooterHtmlSpacing($config->getFooterHtmlSpacing());
165  $this->setFooterHtml($config->getFooterHtml());
166  $this->setFooterHtmlLine($config->isFooterHtmlLine());
167  $this->setHeaderHtmlSpacing($config->getHeaderHtmlSpacing());
168  $this->setHeaderHtml($config->getHeaderHtml());
169  $this->setHeaderHtmlLine($config->isHeaderHtmlLine());
170  $this->setHeaderTextLine($config->isHeaderTextLine());
171  $this->setHeaderTextSpacing($config->getHeaderTextSpacing());
172  $this->setHeaderTextRight($config->getHeaderTextRight());
173  $this->setHeaderTextCenter($config->getHeaderTextCenter());
174  $this->setHeaderTextLeft($config->getHeaderTextLeft());
175  $this->setHeaderType($config->getHeaderType());
177  $this->setRadioButtonSvg($config->getRadioButtonSvg());
178  $this->setCheckboxCheckedSvg($config->getCheckboxCheckedSvg());
179  $this->setCheckboxSvg($config->getCheckboxSvg());
180  $this->setJavascriptDelay($config->getJavascriptDelay());
181  $this->setPrintMediaType($config->getPrintMediaType());
182  $this->setMarginTop($config->getMarginTop());
183  $this->setMarginBottom($config->getMarginBottom());
185  }
186 
187  public function getZoom(): float
188  {
189  return $this->zoom;
190  }
191 
192  public function setZoom(float $zoom): void
193  {
194  $this->zoom = $zoom;
195  }
196 
197  public function getEnabledForms(): bool
198  {
199  return $this->enabled_forms;
200  }
201 
202  public function setEnabledForms(?bool $enabled_forms): void
203  {
204  $this->enabled_forms = $enabled_forms;
205  }
206 
207  public function getExternalLinks(): bool
208  {
209  return $this->external_links;
210  }
211 
212  public function setExternalLinks(bool $external_links): void
213  {
214  $this->external_links = $external_links;
215  }
216 
217  public function getLowQuality(): bool
218  {
219  return $this->low_quality;
220  }
221 
222  public function setLowQuality(bool $low_quality): void
223  {
224  $this->low_quality = $low_quality;
225  }
226 
227  public function getGreyscale(): bool
228  {
229  return $this->greyscale;
230  }
231 
232  public function setGreyscale(bool $greyscale): void
233  {
234  $this->greyscale = $greyscale;
235  }
236 
237  public function getOrientation(): string
238  {
239  return $this->orientation;
240  }
241 
242  public function setOrientation(string $orientation): void
243  {
244  $this->orientation = $orientation;
245  }
246 
247  public function getPageSize(): string
248  {
249  return $this->page_size;
250  }
251 
252  public function setPageSize(string $page_size): void
253  {
254  $this->page_size = $page_size;
255  }
256 
257  public function getMarginLeft(): string
258  {
259  return $this->margin_left;
260  }
261 
262  public function setMarginLeft(string $margin_left): void
263  {
264  $this->margin_left = $margin_left;
265  }
266 
267  public function getMarginRight(): string
268  {
269  return $this->margin_right;
270  }
271 
272  public function setMarginRight(string $margin_right): void
273  {
274  $this->margin_right = $margin_right;
275  }
276 
277  public function getFooterHtmlSpacing(): int
278  {
280  }
281 
282  public function setFooterHtmlSpacing(int $footer_html_spacing): void
283  {
284  $this->footer_html_spacing = $footer_html_spacing;
285  }
286 
287  public function getFooterHtml(): string
288  {
289  return $this->footer_html;
290  }
291 
292  public function setFooterHtml(string $footer_html): void
293  {
294  $this->footer_html = $footer_html;
295  }
296 
297  public function isFooterTextLine(): bool
298  {
300  }
301 
302  public function setFooterTextLine(bool $footer_text_line): void
303  {
304  $this->footer_text_line = $footer_text_line;
305  }
306 
307  public function getFooterTextCenter(): string
308  {
310  }
311 
312  public function setFooterTextCenter(string $footer_text_center): void
313  {
314  $this->footer_text_center = $footer_text_center;
315  }
316 
317  public function getFooterTextSpacing(): int
318  {
320  }
321 
322  public function setFooterTextSpacing(int $footer_text_spacing): void
323  {
324  $this->footer_text_spacing = $footer_text_spacing;
325  }
326 
327  public function getFooterTextRight(): string
328  {
330  }
331 
332  public function setFooterTextRight(string $footer_text_right): void
333  {
334  $this->footer_text_right = $footer_text_right;
335  }
336 
337  public function getFooterTextLeft(): string
338  {
340  }
341 
342  public function setFooterTextLeft(string $footer_text_left): void
343  {
344  $this->footer_text_left = $footer_text_left;
345  }
346 
347  public function getFooterType(): int
348  {
349  return $this->footer_type;
350  }
351 
352  public function setFooterType(int $footer_type): void
353  {
354  $this->footer_type = $footer_type;
355  }
356 
357  public function isFooterHtmlLine(): bool
358  {
360  }
361 
362  public function setFooterHtmlLine(bool $footer_html_line): void
363  {
364  $this->footer_html_line = $footer_html_line;
365  }
366 
367  public function isHeaderTextLine(): bool
368  {
370  }
371 
372  public function setHeaderTextLine(bool $header_text_line): void
373  {
374  $this->header_text_line = $header_text_line;
375  }
376 
377  public function getHeaderTextSpacing(): int
378  {
380  }
381 
382  public function setHeaderTextSpacing(int $header_text_spacing): void
383  {
384  $this->header_text_spacing = $header_text_spacing;
385  }
386 
387  public function getHeaderTextRight(): string
388  {
390  }
391 
392  public function setHeaderTextRight(string $header_text_right): void
393  {
394  $this->header_text_right = $header_text_right;
395  }
396 
397  public function getHeaderTextCenter(): string
398  {
400  }
401 
402  public function setHeaderTextCenter(string $header_text_center): void
403  {
404  $this->header_text_center = $header_text_center;
405  }
406 
407  public function getHeaderTextLeft(): string
408  {
410  }
411 
412  public function setHeaderTextLeft(string $header_text_left): void
413  {
414  $this->header_text_left = $header_text_left;
415  }
416 
417  public function getHeaderType(): int
418  {
419  return $this->header_type;
420  }
421 
422  public function setHeaderType(int $header_type): void
423  {
424  $this->header_type = $header_type;
425  }
426 
427  public function getRadioButtonCheckedSvg(): string
428  {
430  }
431 
432  public function setRadioButtonCheckedSvg(string $radio_button_checked_svg): void
433  {
434  $this->radio_button_checked_svg = $radio_button_checked_svg;
435  }
436 
437  public function getRadioButtonSvg(): string
438  {
440  }
441 
442  public function setRadioButtonSvg(string $radio_button_svg): void
443  {
444  $this->radio_button_svg = $radio_button_svg;
445  }
446 
447  public function getCheckboxCheckedSvg(): string
448  {
450  }
451 
452  public function setCheckboxCheckedSvg(string $checkbox_checked_svg): void
453  {
454  $this->checkbox_checked_svg = $checkbox_checked_svg;
455  }
456 
457  public function getCheckboxSvg(): string
458  {
459  return $this->checkbox_svg;
460  }
461 
462  public function setCheckboxSvg(string $checkbox_svg): void
463  {
464  $this->checkbox_svg = $checkbox_svg;
465  }
466 
467  public function getJavascriptDelay(): int
468  {
470  }
471 
472  public function setJavascriptDelay(int $javascript_delay): void
473  {
474  $this->javascript_delay = $javascript_delay;
475  }
476 
477  public function getPrintMediaType(): bool
478  {
480  }
481 
482  public function setPrintMediaType(bool $print_media_type): void
483  {
484  $this->print_media_type = $print_media_type;
485  }
486 
487  public function getMarginTop(): string
488  {
489  return $this->margin_top;
490  }
491 
492  public function setMarginTop(string $margin_top): void
493  {
494  $this->margin_top = $margin_top;
495  }
496 
497  public function getMarginBottom(): string
498  {
499  return $this->margin_bottom;
500  }
501 
502  public function setMarginBottom(string $margin_bottom): void
503  {
504  $this->margin_bottom = $margin_bottom;
505  }
506 
507  public function getOverwriteDefaultFont(bool $renderStyle = false): string
508  {
509  if ($renderStyle) {
510  if ($this->overwrite_default_font !== '') {
511  return '<style>body{font-family: ' . $this->overwrite_default_font . ';}</style>';
512  }
513 
514  return '';
515  }
516  if ($this->overwrite_default_font === '') {
517  return 'arial';
518  }
519 
521  }
522 
523  public function setOverwriteDefaultFont(string $overwrite_default_font): void
524  {
525  $this->overwrite_default_font = $overwrite_default_font;
526  }
527 
528  protected function useDefaultConfig(): void
529  {
530  $this->setExternalLinks(true);
531  $this->setEnabledForms(false);
532  $this->setJavascriptDelay(500);
533  $this->setZoom(1);
534  $this->setOrientation('Portrait');
535  $this->setPageSize('A4');
536  $this->setMarginLeft('0.5cm');
537  $this->setMarginRight('2cm');
538  $this->setMarginBottom('0.5cm');
539  $this->setMarginTop('2cm');
540  }
541 
542  public static function supportMultiSourcesFiles(): bool
543  {
544  return true;
545  }
546 
547  public function getPath(): string
548  {
549  return $this->path;
550  }
551 
552  public function setPath(string $path): void
553  {
554  $this->path = $path;
555  }
556 
557  public function getWKHTMLToPdfDefaultPath(): string
558  {
559  $path = $this->getSavedDefaultBinaryPath();
560  if ($path !== '') {
561  return $path;
562  }
563 
564  return '/usr/local/bin/wkhtmltopdf';
565  }
566 
567  public function getConfig(): array
568  {
569  return $this->config;
570  }
571 
572  public function getCommandLineConfig(): string
573  {
574  $this->generateCommandLineConfig();
575 
576  $settings = ' ';
577  foreach ($this->config as $value) {
578  $settings .= '--' . $value . ' ';
579  }
580 
581  return $settings;
582  }
583 
584  protected function generateCommandLineConfig(): void
585  {
586  $this->getZoomArgument();
587  $this->getExternalLinksArgument();
588  $this->getEnabledFormsArgument();
589  $this->getGreyscaleArgument();
590  $this->getLowQualityArgument();
591  $this->getOrientationArgument();
592  $this->getPrintMediaTypeArgument();
593  $this->getPageSizeArgument();
595  $this->getCheckboxSvgArgument();
597  $this->getRadioButtonSvgArgument();
599  $this->getMarginArgument();
600  $this->getHeaderArgument();
601  $this->getFooterArgument();
602  $this->getDebugArgument();
603  $this->getSessionObject();
604  }
605 
606  protected function getZoomArgument(): void
607  {
608  if ($this->getZoom()) {
609  $this->config[] = 'zoom ' . $this->getZoom();
610  }
611  }
612 
613  protected function getExternalLinksArgument(): void
614  {
615  if ($this->getExternalLinks()) {
616  $this->config[] = 'enable-external-links';
617  } else {
618  $this->config[] = 'disable-external-links';
619  }
620  }
621 
622  protected function getEnabledFormsArgument(): void
623  {
624  if ($this->getEnabledForms()) {
625  $this->config[] = 'enable-forms';
626  } else {
627  $this->config[] = 'disable-forms';
628  }
629  }
630 
631  protected function getGreyscaleArgument(): void
632  {
633  if ($this->getGreyscale()) {
634  $this->config[] = 'grayscale';
635  }
636  }
637 
638  protected function getLowQualityArgument(): void
639  {
640  if ($this->getLowQuality()) {
641  $this->config[] = 'lowquality';
642  }
643  }
644 
645  protected function getOrientationArgument(): void
646  {
647  $orientation = $this->getOrientation();
648  if ($orientation === '' || $orientation === 'Portrait') {
649  $this->config[] = 'orientation Portrait';
650  } else {
651  $this->config[] = 'orientation Landscape';
652  }
653  }
654 
655  protected function getPrintMediaTypeArgument(): void
656  {
657  if ($this->getPrintMediaType()) {
658  $this->config[] = 'print-media-type';
659  }
660  }
661 
662  protected function getPageSizeArgument(): void
663  {
664  if ($this->getPageSize() !== '') {
665  $this->config[] = 'page-size ' . ilShellUtil::escapeShellArg($this->getPageSize());
666  }
667  }
668 
669  protected function getJavascriptDelayArgument(): void
670  {
671  if ($this->getJavascriptDelay() > 0) {
672  $this->config[] = 'javascript-delay ' . $this->getJavascriptDelay();
673  }
674  }
675 
676  protected function getCheckboxSvgArgument(): void
677  {
678  $checkbox_svg = $this->getCheckboxSvg();
679  if ($checkbox_svg !== '') {
680  $this->config[] = 'checkbox-svg ' . ilShellUtil::escapeShellArg($checkbox_svg);
681  }
682  }
683 
684  protected function getCheckboxCheckedSvgArgument(): void
685  {
686  $checkbox_svg = $this->getCheckboxCheckedSvg();
687  if ($checkbox_svg !== '') {
688  $this->config[] = 'checkbox-checked-svg ' . ilShellUtil::escapeShellArg($checkbox_svg);
689  }
690  }
691 
692  protected function getRadioButtonSvgArgument(): void
693  {
694  $radio_button_svg = $this->getRadioButtonSvg();
695  if ($radio_button_svg !== '') {
696  $this->config[] = 'radiobutton-svg ' . ilShellUtil::escapeShellArg($radio_button_svg);
697  }
698  }
699 
700  protected function getRadioButtonCheckedSvgArgument(): void
701  {
702  $radio_button_svg = $this->getRadioButtonCheckedSvg();
703  if ($radio_button_svg !== '') {
704  $this->config[] = 'radiobutton-checked-svg ' . ilShellUtil::escapeShellArg($radio_button_svg);
705  }
706  }
707 
708  protected function getMarginArgument(): void
709  {
710  if ($this->getMarginBottom() !== '') {
711  $this->config[] = 'margin-bottom ' . ilShellUtil::escapeShellArg($this->getMarginBottom());
712  }
713  if ($this->getMarginLeft() !== '') {
714  $this->config[] = 'margin-left ' . ilShellUtil::escapeShellArg($this->getMarginLeft());
715  }
716  if ($this->getMarginRight() !== '') {
717  $this->config[] = 'margin-right ' . ilShellUtil::escapeShellArg($this->getMarginRight());
718  }
719  if ($this->getMarginTop() !== '') {
720  $this->config[] = 'margin-top ' . ilShellUtil::escapeShellArg($this->getMarginTop());
721  }
722  }
723 
724  protected function getHeaderArgument(): void
725  {
726  $header_value = $this->getHeaderType();
727  if ($header_value === ilPDFGenerationConstants::HEADER_TEXT) {
728  $this->config[] = 'header-left ' . ilShellUtil::escapeShellArg($this->getHeaderTextLeft());
729  $this->config[] = 'header-center ' . ilShellUtil::escapeShellArg($this->getHeaderTextCenter());
730  $this->config[] = 'header-right ' . ilShellUtil::escapeShellArg($this->getHeaderTextRight());
731  if ($this->getHeaderTextSpacing() > 0) {
732  $this->config[] = 'header-spacing ' . $this->getHeaderTextSpacing();
733  }
734 
735  if ($this->isHeaderTextLine()) {
736  $this->config[] = 'header-line';
737  }
738  } elseif ($header_value === ilPDFGenerationConstants::HEADER_HTML) {
739  $this->config[] = 'header-html ' . ilShellUtil::escapeShellArg($this->getHeaderHtml());
740 
741  if ($this->getHeaderHtmlSpacing() > 0) {
742  $this->config[] = 'header-spacing ' . $this->getHeaderHtmlSpacing();
743  }
744  if ($this->isHeaderHtmlLine()) {
745  $this->config[] = 'header-line';
746  }
747  }
748  }
749 
750  public function getHeaderHtml(): string
751  {
752  return $this->header_html;
753  }
754 
755  public function setHeaderHtml(string $header_html): void
756  {
757  $this->header_html = $header_html;
758  }
759 
760  public function getHeaderHtmlSpacing(): int
761  {
763  }
764 
765  public function setHeaderHtmlSpacing(int $header_html_spacing): void
766  {
767  $this->header_html_spacing = $header_html_spacing;
768  }
769 
770  public function isHeaderHtmlLine(): bool
771  {
773  }
774 
775  public function setHeaderHtmlLine(bool $header_html_line): void
776  {
777  $this->header_html_line = $header_html_line;
778  }
779 
780  protected function getFooterArgument(): void
781  {
782  $footer_value = $this->getFooterType();
783  if ($footer_value === ilPDFGenerationConstants::FOOTER_TEXT) {
784  $this->config[] = 'footer-left ' . ilShellUtil::escapeShellArg($this->getFooterTextLeft());
785  $this->config[] = 'footer-center ' . ilShellUtil::escapeShellArg($this->getFooterTextCenter());
786  $this->config[] = 'footer-right ' . ilShellUtil::escapeShellArg($this->getFooterTextRight());
787  if ($this->getFooterTextSpacing() > 0) {
788  $this->config[] = 'footer-spacing ' . $this->getFooterTextSpacing();
789  }
790 
791  if ($this->isFooterTextLine()) {
792  $this->config[] = 'footer-line';
793  }
794  } elseif ($footer_value === ilPDFGenerationConstants::FOOTER_HTML) {
795  $this->config[] = 'footer-html ' . ilShellUtil::escapeShellArg($this->getFooterHtml());
796 
797  if ($this->getFooterHtmlSpacing() > 0) {
798  $this->config[] = 'footer-spacing ' . $this->getFooterHtmlSpacing();
799  }
800  if ($this->isFooterHtmlLine()) {
801  $this->config[] = 'footer-line';
802  }
803  }
804  }
805 
806  protected function getDebugArgument(): void
807  {
808  if (self::ENABLE_QUIET) {
809  $this->config[] = 'quiet';
810  }
811  }
812 
813  protected function getSessionObject(): void
814  {
815  $this->config[] = 'cookie "PHPSESSID" "' . session_id() . '"';
816  if (defined('CLIENT_ID')) {
817  $this->config[] = 'cookie "ilClientId" "' . CLIENT_ID . '"';
818  }
819  }
820 
821  protected function getSavedDefaultBinaryPath(): string
822  {
823  $settings = new ilSetting('wkhtmltopdfrenderer');
824  $path = $settings->get('path');
825  if ($path !== null && $path !== '') {
826  return $path;
827  }
828 
829  return '';
830  }
831 }
setKeyIfExists(string $function, string $key, array $config)
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
setFooterHtmlLine(bool $footer_html_line)
setMarginBottom(string $margin_bottom)
setHeaderTextSpacing(int $header_text_spacing)
$type
setFooterTextCenter(string $footer_text_center)
setFooterHtmlSpacing(int $footer_html_spacing)
readConfigFromObject(ilWkhtmlToPdfConfig $config)
setHeaderTextCenter(string $header_text_center)
setMarginRight(string $margin_right)
setFooterTextRight(string $footer_text_right)
setJavascriptDelay(int $javascript_delay)
static escapeShellArg(string $a_arg)
setCheckboxCheckedSvg(string $checkbox_checked_svg)
getOverwriteDefaultFont(bool $renderStyle=false)
setRadioButtonCheckedSvg(string $radio_button_checked_svg)
setOverwriteDefaultFont(string $overwrite_default_font)
setFooterHtml(string $footer_html)
setFooterTextLine(bool $footer_text_line)
setHeaderHtmlSpacing(int $header_html_spacing)
setOrientation(string $orientation)
const CLIENT_ID
Definition: constants.php:41
string $key
Consumer key/client ID value.
Definition: System.php:193
setHeaderTextRight(string $header_text_right)
setFooterTextSpacing(int $footer_text_spacing)
setRadioButtonSvg(string $radio_button_svg)
setMarginLeft(string $margin_left)
setPrintMediaType(bool $print_media_type)
setHeaderTextLine(bool $header_text_line)
setCheckboxSvg(string $checkbox_svg)
setHeaderHtml(string $header_html)
setHeaderTextLeft(string $header_text_left)
setEnabledForms(?bool $enabled_forms)
setLowQuality(bool $low_quality)
setMarginTop(string $margin_top)
setExternalLinks(bool $external_links)
setHeaderHtmlLine(bool $header_html_line)
setFooterTextLeft(string $footer_text_left)