forked from dompdf/dompdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Options.php
1267 lines (1145 loc) · 34.8 KB
/
Options.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @package dompdf
* @link https://github.com/dompdf/dompdf
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
namespace Dompdf;
class Options
{
/**
* The root of your DOMPDF installation
*
* @var string
*/
private $rootDir;
/**
* The location of a temporary directory.
*
* The directory specified must be writable by the executing process.
* The temporary directory is required to download remote images and when
* using the PFDLib back end.
*
* @var string
*/
private $tempDir;
/**
* The location of the DOMPDF font directory
*
* The location of the directory where DOMPDF will store fonts and font metrics
* Note: This directory must exist and be writable by the executing process.
*
* @var string
*/
private $fontDir;
/**
* The location of the DOMPDF font cache directory
*
* This directory contains the cached font metrics for the fonts used by DOMPDF.
* This directory can be the same as $fontDir
*
* Note: This directory must exist and be writable by the executing process.
*
* @var string
*/
private $fontCache;
/**
* dompdf's "chroot"
*
* Utilized by Dompdf's default file:// protocol URI validation rule.
* All local files opened by dompdf must be in a subdirectory of the directory
* or directories specified by this option.
* DO NOT set this value to '/' since this could allow an attacker to use dompdf to
* read any files on the server. This should be an absolute path.
*
* ==== IMPORTANT ====
* This setting may increase the risk of system exploit. Do not change
* this settings without understanding the consequences. Additional
* documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var array
*/
private $chroot;
/**
* Protocol whitelist
*
* Protocols and PHP wrappers allowed in URIs, and the validation rules
* that determine if a resource may be loaded. Full support is not guaranteed
* for the protocols/wrappers specified
* by this array.
*
* @var array
*/
private $allowedProtocols = [
"file://" => ["rules" => []],
"http://" => ["rules" => []],
"https://" => ["rules" => []]
];
/**
* Operational artifact (log files, temporary files) path validation
*
* @var callable
*/
private $artifactPathValidation = null;
/**
* @var string
*/
private $logOutputFile = '';
/**
* Styles targeted to this media type are applied to the document.
* This is on top of the media types that are always applied:
* all, static, visual, bitmap, paged, dompdf
*
* @var string
*/
private $defaultMediaType = "screen";
/**
* The default paper size.
*
* North America standard is "letter"; other countries generally "a4"
* @see \Dompdf\Adapter\CPDF::PAPER_SIZES for valid sizes
*
* @var string|float[]
*/
private $defaultPaperSize = "letter";
/**
* The default paper orientation.
*
* The orientation of the page (portrait or landscape).
*
* @var string
*/
private $defaultPaperOrientation = "portrait";
/**
* The default font family
*
* Used if no suitable fonts can be found. This must exist in the font folder.
*
* @var string
*/
private $defaultFont = "serif";
/**
* Image DPI setting
*
* This setting determines the default DPI setting for images and fonts. The
* DPI may be overridden for inline images by explicitly setting the
* image's width & height style attributes (i.e. if the image's native
* width is 600 pixels and you specify the image's width as 72 points,
* the image will have a DPI of 600 in the rendered PDF. The DPI of
* background images can not be overridden and is controlled entirely
* via this parameter.
*
* For the purposes of DOMPDF, pixels per inch (PPI) = dots per inch (DPI).
* If a size in html is given as px (or without unit as image size),
* this tells the corresponding size in pt at 72 DPI.
* This adjusts the relative sizes to be similar to the rendering of the
* html page in a reference browser.
*
* In pdf, always 1 pt = 1/72 inch
*
* @var int
*/
private $dpi = 96;
/**
* A ratio applied to the fonts height to be more like browsers' line height
*
* @var float
*/
private $fontHeightRatio = 1.1;
/**
* Enable embedded PHP
*
* If this setting is set to true then DOMPDF will automatically evaluate
* embedded PHP contained within <script type="text/php"> ... </script> tags.
*
* ==== IMPORTANT ====
* Enabling this for documents you do not trust (e.g. arbitrary remote html
* pages) is a security risk. Embedded scripts are run with the same level of
* system access available to dompdf. Set this option to false (recommended)
* if you wish to process untrusted documents.
*
* This setting may increase the risk of system exploit. Do not change
* this settings without understanding the consequences. Additional
* documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
private $isPhpEnabled = false;
/**
* Enable remote file access
*
* If this setting is set to true, DOMPDF will access remote sites for
* images and CSS files as required.
*
* ==== IMPORTANT ====
* This can be a security risk, in particular in combination with isPhpEnabled and
* allowing remote html code to be passed to $dompdf = new DOMPDF(); $dompdf->load_html(...);
* This allows anonymous users to download legally doubtful internet content which on
* tracing back appears to being downloaded by your server, or allows malicious php code
* in remote html pages to be executed by your server with your account privileges.
*
* This setting may increase the risk of system exploit. Do not change
* this settings without understanding the consequences. Additional
* documentation is available on the dompdf wiki at:
* https://github.com/dompdf/dompdf/wiki
*
* @var bool
*/
private $isRemoteEnabled = false;
/**
* List of allowed remote hosts
*
* Each value of the array must be a valid hostname.
*
* This will be used to filter which resources can be loaded in combination with
* isRemoteEnabled. If isRemoteEnabled is FALSE, then this will have no effect.
*
* Leave to NULL to allow any remote host.
*
* @var array|null
*/
private $allowedRemoteHosts = null;
/**
* Enable inline JavaScript
*
* If this setting is set to true then DOMPDF will automatically insert
* JavaScript code contained within <script type="text/javascript"> ... </script>
* tags as written into the PDF.
*
* NOTE: This is PDF-based JavaScript to be executed by the PDF viewer,
* not browser-based JavaScript executed by Dompdf.
*
* @var bool
*/
private $isJavascriptEnabled = true;
/**
* Use the HTML5 Lib parser
*
* @deprecated
* @var bool
*/
private $isHtml5ParserEnabled = true;
/**
* Whether to enable font subsetting or not.
*
* @var bool
*/
private $isFontSubsettingEnabled = true;
/**
* @var bool
*/
private $debugPng = false;
/**
* @var bool
*/
private $debugKeepTemp = false;
/**
* @var bool
*/
private $debugCss = false;
/**
* @var bool
*/
private $debugLayout = false;
/**
* @var bool
*/
private $debugLayoutLines = true;
/**
* @var bool
*/
private $debugLayoutBlocks = true;
/**
* @var bool
*/
private $debugLayoutInline = true;
/**
* @var bool
*/
private $debugLayoutPaddingBox = true;
/**
* The PDF rendering backend to use
*
* Valid settings are 'PDFLib', 'CPDF', 'GD', and 'auto'. 'auto' will
* look for PDFLib and use it if found, or if not it will fall back on
* CPDF. 'GD' renders PDFs to graphic files. {@link Dompdf\CanvasFactory}
* ultimately determines which rendering class to instantiate
* based on this setting.
*
* @var string
*/
private $pdfBackend = "CPDF";
/**
* PDFlib license key
*
* If you are using a licensed, commercial version of PDFlib, specify
* your license key here. If you are using PDFlib-Lite or are evaluating
* the commercial version of PDFlib, comment out this setting.
*
* @link http://www.pdflib.com
*
* If pdflib present in web server and auto or selected explicitly above,
* a real license code must exist!
*
* @var string
*/
private $pdflibLicense = "";
/**
* HTTP context created with stream_context_create()
* Will be used for file_get_contents
*
* @link https://www.php.net/manual/context.php
*
* @var resource
*/
private $httpContext;
/**
* @param array $attributes
*/
public function __construct(?array $attributes = null)
{
$rootDir = realpath(__DIR__ . "/../");
$this->setChroot(array($rootDir));
$this->setRootDir($rootDir);
$this->setTempDir(sys_get_temp_dir());
$this->setFontDir($rootDir . "/lib/fonts");
$this->setFontCache($this->getFontDir());
$ver = "";
$versionFile = realpath(__DIR__ . '/../VERSION');
if (($version = file_get_contents($versionFile)) !== false) {
$version = trim($version);
if ($version !== '$Format:<%h>$') {
$ver = "/$version";
}
}
$this->setHttpContext([
"http" => [
"follow_location" => false,
"user_agent" => "Dompdf$ver https://github.com/dompdf/dompdf"
]
]);
$this->setAllowedProtocols(["file://", "http://", "https://"]);
$this->setArtifactPathValidation([$this, "validateArtifactPath"]);
if (null !== $attributes) {
$this->set($attributes);
}
}
/**
* @param array|string $attributes
* @param null|mixed $value
* @return $this
*/
public function set($attributes, $value = null)
{
if (!is_array($attributes)) {
$attributes = [$attributes => $value];
}
foreach ($attributes as $key => $value) {
if ($key === 'tempDir' || $key === 'temp_dir') {
$this->setTempDir($value);
} elseif ($key === 'fontDir' || $key === 'font_dir') {
$this->setFontDir($value);
} elseif ($key === 'fontCache' || $key === 'font_cache') {
$this->setFontCache($value);
} elseif ($key === 'chroot') {
$this->setChroot($value);
} elseif ($key === 'allowedProtocols' || $key === 'allowed_protocols') {
$this->setAllowedProtocols($value);
} elseif ($key === 'artifactPathValidation') {
$this->setArtifactPathValidation($value);
} elseif ($key === 'logOutputFile' || $key === 'log_output_file') {
$this->setLogOutputFile($value);
} elseif ($key === 'defaultMediaType' || $key === 'default_media_type') {
$this->setDefaultMediaType($value);
} elseif ($key === 'defaultPaperSize' || $key === 'default_paper_size') {
$this->setDefaultPaperSize($value);
} elseif ($key === 'defaultPaperOrientation' || $key === 'default_paper_orientation') {
$this->setDefaultPaperOrientation($value);
} elseif ($key === 'defaultFont' || $key === 'default_font') {
$this->setDefaultFont($value);
} elseif ($key === 'dpi') {
$this->setDpi($value);
} elseif ($key === 'fontHeightRatio' || $key === 'font_height_ratio') {
$this->setFontHeightRatio($value);
} elseif ($key === 'isPhpEnabled' || $key === 'is_php_enabled' || $key === 'enable_php') {
$this->setIsPhpEnabled($value);
} elseif ($key === 'isRemoteEnabled' || $key === 'is_remote_enabled' || $key === 'enable_remote') {
$this->setIsRemoteEnabled($value);
} elseif ($key === 'allowedRemoteHosts' || $key === 'allowed_remote_hosts') {
$this->setAllowedRemoteHosts($value);
} elseif ($key === 'isJavascriptEnabled' || $key === 'is_javascript_enabled' || $key === 'enable_javascript') {
$this->setIsJavascriptEnabled($value);
} elseif ($key === 'isHtml5ParserEnabled' || $key === 'is_html5_parser_enabled' || $key === 'enable_html5_parser') {
$this->setIsHtml5ParserEnabled($value);
} elseif ($key === 'isFontSubsettingEnabled' || $key === 'is_font_subsetting_enabled' || $key === 'enable_font_subsetting') {
$this->setIsFontSubsettingEnabled($value);
} elseif ($key === 'debugPng' || $key === 'debug_png') {
$this->setDebugPng($value);
} elseif ($key === 'debugKeepTemp' || $key === 'debug_keep_temp') {
$this->setDebugKeepTemp($value);
} elseif ($key === 'debugCss' || $key === 'debug_css') {
$this->setDebugCss($value);
} elseif ($key === 'debugLayout' || $key === 'debug_layout') {
$this->setDebugLayout($value);
} elseif ($key === 'debugLayoutLines' || $key === 'debug_layout_lines') {
$this->setDebugLayoutLines($value);
} elseif ($key === 'debugLayoutBlocks' || $key === 'debug_layout_blocks') {
$this->setDebugLayoutBlocks($value);
} elseif ($key === 'debugLayoutInline' || $key === 'debug_layout_inline') {
$this->setDebugLayoutInline($value);
} elseif ($key === 'debugLayoutPaddingBox' || $key === 'debug_layout_padding_box') {
$this->setDebugLayoutPaddingBox($value);
} elseif ($key === 'pdfBackend' || $key === 'pdf_backend') {
$this->setPdfBackend($value);
} elseif ($key === 'pdflibLicense' || $key === 'pdflib_license') {
$this->setPdflibLicense($value);
} elseif ($key === 'httpContext' || $key === 'http_context') {
$this->setHttpContext($value);
}
}
return $this;
}
/**
* @param string $key
* @return mixed
*/
public function get($key)
{
if ($key === 'tempDir' || $key === 'temp_dir') {
return $this->getTempDir();
} elseif ($key === 'fontDir' || $key === 'font_dir') {
return $this->getFontDir();
} elseif ($key === 'fontCache' || $key === 'font_cache') {
return $this->getFontCache();
} elseif ($key === 'chroot') {
return $this->getChroot();
} elseif ($key === 'allowedProtocols' || $key === 'allowed_protocols') {
return $this->getAllowedProtocols();
} elseif ($key === 'artifactPathValidation') {
return $this->getArtifactPathValidation();
} elseif ($key === 'logOutputFile' || $key === 'log_output_file') {
return $this->getLogOutputFile();
} elseif ($key === 'defaultMediaType' || $key === 'default_media_type') {
return $this->getDefaultMediaType();
} elseif ($key === 'defaultPaperSize' || $key === 'default_paper_size') {
return $this->getDefaultPaperSize();
} elseif ($key === 'defaultPaperOrientation' || $key === 'default_paper_orientation') {
return $this->getDefaultPaperOrientation();
} elseif ($key === 'defaultFont' || $key === 'default_font') {
return $this->getDefaultFont();
} elseif ($key === 'dpi') {
return $this->getDpi();
} elseif ($key === 'fontHeightRatio' || $key === 'font_height_ratio') {
return $this->getFontHeightRatio();
} elseif ($key === 'isPhpEnabled' || $key === 'is_php_enabled' || $key === 'enable_php') {
return $this->getIsPhpEnabled();
} elseif ($key === 'isRemoteEnabled' || $key === 'is_remote_enabled' || $key === 'enable_remote') {
return $this->getIsRemoteEnabled();
} elseif ($key === 'allowedRemoteHosts' || $key === 'allowed_remote_hosts') {
return $this->getAllowedProtocols();
} elseif ($key === 'isJavascriptEnabled' || $key === 'is_javascript_enabled' || $key === 'enable_javascript') {
return $this->getIsJavascriptEnabled();
} elseif ($key === 'isHtml5ParserEnabled' || $key === 'is_html5_parser_enabled' || $key === 'enable_html5_parser') {
return $this->getIsHtml5ParserEnabled();
} elseif ($key === 'isFontSubsettingEnabled' || $key === 'is_font_subsetting_enabled' || $key === 'enable_font_subsetting') {
return $this->getIsFontSubsettingEnabled();
} elseif ($key === 'debugPng' || $key === 'debug_png') {
return $this->getDebugPng();
} elseif ($key === 'debugKeepTemp' || $key === 'debug_keep_temp') {
return $this->getDebugKeepTemp();
} elseif ($key === 'debugCss' || $key === 'debug_css') {
return $this->getDebugCss();
} elseif ($key === 'debugLayout' || $key === 'debug_layout') {
return $this->getDebugLayout();
} elseif ($key === 'debugLayoutLines' || $key === 'debug_layout_lines') {
return $this->getDebugLayoutLines();
} elseif ($key === 'debugLayoutBlocks' || $key === 'debug_layout_blocks') {
return $this->getDebugLayoutBlocks();
} elseif ($key === 'debugLayoutInline' || $key === 'debug_layout_inline') {
return $this->getDebugLayoutInline();
} elseif ($key === 'debugLayoutPaddingBox' || $key === 'debug_layout_padding_box') {
return $this->getDebugLayoutPaddingBox();
} elseif ($key === 'pdfBackend' || $key === 'pdf_backend') {
return $this->getPdfBackend();
} elseif ($key === 'pdflibLicense' || $key === 'pdflib_license') {
return $this->getPdflibLicense();
} elseif ($key === 'httpContext' || $key === 'http_context') {
return $this->getHttpContext();
}
return null;
}
/**
* @param string $pdfBackend
* @return $this
*/
public function setPdfBackend($pdfBackend)
{
$this->pdfBackend = $pdfBackend;
return $this;
}
/**
* @return string
*/
public function getPdfBackend()
{
return $this->pdfBackend;
}
/**
* @param string $pdflibLicense
* @return $this
*/
public function setPdflibLicense($pdflibLicense)
{
$this->pdflibLicense = $pdflibLicense;
return $this;
}
/**
* @return string
*/
public function getPdflibLicense()
{
return $this->pdflibLicense;
}
/**
* @param array|string $chroot
* @return $this
*/
public function setChroot($chroot, $delimiter = ',')
{
if (is_string($chroot)) {
$this->chroot = explode($delimiter, $chroot);
} elseif (is_array($chroot)) {
$this->chroot = $chroot;
}
return $this;
}
/**
* @return array
*/
public function getAllowedProtocols()
{
return $this->allowedProtocols;
}
/**
* @param array $allowedProtocols The protocols to allow, as an array
* formatted as ["protocol://" => ["rules" => [callable]], ...]
* or ["protocol://", ...]
*
* @return $this
*/
public function setAllowedProtocols(array $allowedProtocols)
{
$protocols = [];
foreach ($allowedProtocols as $protocol => $config) {
if (is_string($protocol)) {
$protocols[$protocol] = [];
if (is_array($config)) {
$protocols[$protocol] = $config;
}
} elseif (is_string($config)) {
$protocols[$config] = [];
}
}
$this->allowedProtocols = [];
foreach ($protocols as $protocol => $config) {
$this->addAllowedProtocol($protocol, ...($config["rules"] ?? []));
}
return $this;
}
/**
* Adds a new protocol to the allowed protocols collection
*
* @param string $protocol The scheme to add (e.g. "http://")
* @param callable $rule A callable that validates the protocol
* @return $this
*/
public function addAllowedProtocol(string $protocol, callable ...$rules)
{
$protocol = strtolower($protocol);
if (empty($rules)) {
$rules = [];
switch ($protocol) {
case "file://":
$rules[] = [$this, "validateLocalUri"];
break;
case "http://":
case "https://":
$rules[] = [$this, "validateRemoteUri"];
break;
case "phar://":
$rules[] = [$this, "validatePharUri"];
break;
}
}
$this->allowedProtocols[$protocol] = ["rules" => $rules];
return $this;
}
/**
* @return array
*/
public function getArtifactPathValidation()
{
return $this->artifactPathValidation;
}
/**
* @param callable $validator
* @return $this
*/
public function setArtifactPathValidation($validator)
{
$this->artifactPathValidation = $validator;
return $this;
}
/**
* @return array
*/
public function getChroot()
{
$chroot = [];
if (is_array($this->chroot)) {
$chroot = $this->chroot;
}
return $chroot;
}
/**
* @param boolean $debugCss
* @return $this
*/
public function setDebugCss($debugCss)
{
$this->debugCss = $debugCss;
return $this;
}
/**
* @return boolean
*/
public function getDebugCss()
{
return $this->debugCss;
}
/**
* @param boolean $debugKeepTemp
* @return $this
*/
public function setDebugKeepTemp($debugKeepTemp)
{
$this->debugKeepTemp = $debugKeepTemp;
return $this;
}
/**
* @return boolean
*/
public function getDebugKeepTemp()
{
return $this->debugKeepTemp;
}
/**
* @param boolean $debugLayout
* @return $this
*/
public function setDebugLayout($debugLayout)
{
$this->debugLayout = $debugLayout;
return $this;
}
/**
* @return boolean
*/
public function getDebugLayout()
{
return $this->debugLayout;
}
/**
* @param boolean $debugLayoutBlocks
* @return $this
*/
public function setDebugLayoutBlocks($debugLayoutBlocks)
{
$this->debugLayoutBlocks = $debugLayoutBlocks;
return $this;
}
/**
* @return boolean
*/
public function getDebugLayoutBlocks()
{
return $this->debugLayoutBlocks;
}
/**
* @param boolean $debugLayoutInline
* @return $this
*/
public function setDebugLayoutInline($debugLayoutInline)
{
$this->debugLayoutInline = $debugLayoutInline;
return $this;
}
/**
* @return boolean
*/
public function getDebugLayoutInline()
{
return $this->debugLayoutInline;
}
/**
* @param boolean $debugLayoutLines
* @return $this
*/
public function setDebugLayoutLines($debugLayoutLines)
{
$this->debugLayoutLines = $debugLayoutLines;
return $this;
}
/**
* @return boolean
*/
public function getDebugLayoutLines()
{
return $this->debugLayoutLines;
}
/**
* @param boolean $debugLayoutPaddingBox
* @return $this
*/
public function setDebugLayoutPaddingBox($debugLayoutPaddingBox)
{
$this->debugLayoutPaddingBox = $debugLayoutPaddingBox;
return $this;
}
/**
* @return boolean
*/
public function getDebugLayoutPaddingBox()
{
return $this->debugLayoutPaddingBox;
}
/**
* @param boolean $debugPng
* @return $this
*/
public function setDebugPng($debugPng)
{
$this->debugPng = $debugPng;
return $this;
}
/**
* @return boolean
*/
public function getDebugPng()
{
return $this->debugPng;
}
/**
* @param string $defaultFont
* @return $this
*/
public function setDefaultFont($defaultFont)
{
if (!($defaultFont === null || trim($defaultFont) === "")) {
$this->defaultFont = $defaultFont;
} else {
$this->defaultFont = "serif";
}
return $this;
}
/**
* @return string
*/
public function getDefaultFont()
{
return $this->defaultFont;
}
/**
* @param string $defaultMediaType
* @return $this
*/
public function setDefaultMediaType($defaultMediaType)
{
$this->defaultMediaType = $defaultMediaType;
return $this;
}
/**
* @return string
*/
public function getDefaultMediaType()
{
return $this->defaultMediaType;
}
/**
* @param string|float[] $defaultPaperSize
* @return $this
*/
public function setDefaultPaperSize($defaultPaperSize): self
{
$this->defaultPaperSize = $defaultPaperSize;
return $this;
}
/**
* @param string $defaultPaperOrientation
* @return $this
*/
public function setDefaultPaperOrientation(string $defaultPaperOrientation): self
{
$this->defaultPaperOrientation = $defaultPaperOrientation;
return $this;
}
/**
* @return string|float[]
*/
public function getDefaultPaperSize()
{
return $this->defaultPaperSize;
}
/**
* @return string
*/
public function getDefaultPaperOrientation(): string
{
return $this->defaultPaperOrientation;
}
/**
* @param int $dpi
* @return $this
*/
public function setDpi($dpi)
{
$this->dpi = $dpi;
return $this;
}
/**
* @return int
*/
public function getDpi()
{
return $this->dpi;
}
/**
* @param string $fontCache
* @return $this
*/
public function setFontCache($fontCache)
{
if (!is_callable($this->artifactPathValidation) || ($this->artifactPathValidation)($fontCache, "fontCache") === true) {
$this->fontCache = $fontCache;
}
return $this;
}
/**
* @return string
*/
public function getFontCache()
{
return $this->fontCache;
}
/**
* @param string $fontDir
* @return $this
*/
public function setFontDir($fontDir)
{
if (!is_callable($this->artifactPathValidation) || ($this->artifactPathValidation)($fontDir, "fontDir") === true) {
$this->fontDir = $fontDir;
}
return $this;
}
/**
* @return string
*/
public function getFontDir()
{
return $this->fontDir;
}
/**
* @param float $fontHeightRatio
* @return $this
*/
public function setFontHeightRatio($fontHeightRatio)
{
$this->fontHeightRatio = $fontHeightRatio;
return $this;
}
/**
* @return float
*/
public function getFontHeightRatio()
{
return $this->fontHeightRatio;
}
/**
* @param boolean $isFontSubsettingEnabled
* @return $this
*/
public function setIsFontSubsettingEnabled($isFontSubsettingEnabled)
{
$this->isFontSubsettingEnabled = $isFontSubsettingEnabled;
return $this;
}
/**
* @return boolean
*/
public function getIsFontSubsettingEnabled()
{
return $this->isFontSubsettingEnabled;
}
/**
* @return boolean
*/
public function isFontSubsettingEnabled()
{
return $this->getIsFontSubsettingEnabled();
}
/**
* @deprecated
* @param boolean $isHtml5ParserEnabled
* @return $this
*/
public function setIsHtml5ParserEnabled($isHtml5ParserEnabled)
{
$this->isHtml5ParserEnabled = $isHtml5ParserEnabled;
return $this;
}
/**
* @deprecated
* @return boolean
*/
public function getIsHtml5ParserEnabled()
{
return $this->isHtml5ParserEnabled;
}
/**
* @deprecated
* @return boolean