-
Notifications
You must be signed in to change notification settings - Fork 4
/
tcpdf_static.php
2851 lines (2779 loc) · 107 KB
/
tcpdf_static.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
//============================================================+
// File name : tcpdf_static.php
// Version : 1.0.004
// Begin : 2002-08-03
// Last Update : 2014-09-02
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
// TCPDF is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// TCPDF is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the License
// along with TCPDF. If not, see
// <http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
//
// Description :
// Static methods used by the TCPDF class.
//
//============================================================+
/**
* @file
* This is a PHP class that contains static methods for the TCPDF class.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.004
*/
/**
* @class TCPDF_STATIC
* Static methods used by the TCPDF class.
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 1.0.004
* @author Nicola Asuni - [email protected]
*/
class TCPDF_STATIC {
/**
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.0.097';
/**
* String alias for total number of pages.
* @public static
*/
public static $alias_tot_pages = '{:ptp:}';
/**
* String alias for page number.
* @public static
*/
public static $alias_num_page = '{:pnp:}';
/**
* String alias for total number of pages in a single group.
* @public static
*/
public static $alias_group_tot_pages = '{:ptg:}';
/**
* String alias for group page number.
* @public static
*/
public static $alias_group_num_page = '{:png:}';
/**
* String alias for right shift compensation used to correctly align page numbers on the right.
* @public static
*/
public static $alias_right_shift = '{rsc:';
/**
* Encryption padding string.
* @public static
*/
public static $enc_padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
/**
* ByteRange placemark used during digital signature process.
* @since 4.6.028 (2009-08-25)
* @public static
*/
public static $byterange_string = '/ByteRange[0 ********** ********** **********]';
/**
* Array page boxes names
* @public static
*/
public static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
* Return the current TCPDF version.
* @return TCPDF version string
* @since 5.9.012 (2010-11-10)
* @public static
*/
public static function getTCPDFVersion() {
return self::$tcpdf_version;
}
/**
* Return the current TCPDF producer.
* @return TCPDF producer string
* @since 6.0.000 (2013-03-16)
* @public static
*/
public static function getTCPDFProducer() {
return "\x54\x43\x50\x44\x46\x20".self::getTCPDFVersion()."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
}
/**
* Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtime function exist)
* @param $mqr (boolean) FALSE for off, TRUE for on.
* @since 4.6.025 (2009-08-17)
* @public static
*/
public static function set_mqr($mqr) {
if (!defined('PHP_VERSION_ID')) {
$version = PHP_VERSION;
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
}
if (PHP_VERSION_ID < 50300) {
@set_magic_quotes_runtime($mqr);
}
}
/**
* Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtime function exist)
* @return Returns 0 if magic quotes runtime is off or get_magic_quotes_runtime doesn't exist, 1 otherwise.
* @since 4.6.025 (2009-08-17)
* @public static
*/
public static function get_mqr() {
if (!defined('PHP_VERSION_ID')) {
$version = PHP_VERSION;
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
}
if (PHP_VERSION_ID < 50300) {
return @get_magic_quotes_runtime();
}
return 0;
}
/**
* Get page dimensions from format name.
* @param $format (mixed) The format name. It can be: <ul>
* <li><b>ISO 216 A Series + 2 SIS 014711 extensions</b></li>
* <li>A0 (841x1189 mm ; 33.11x46.81 in)</li>
* <li>A1 (594x841 mm ; 23.39x33.11 in)</li>
* <li>A2 (420x594 mm ; 16.54x23.39 in)</li>
* <li>A3 (297x420 mm ; 11.69x16.54 in)</li>
* <li>A4 (210x297 mm ; 8.27x11.69 in)</li>
* <li>A5 (148x210 mm ; 5.83x8.27 in)</li>
* <li>A6 (105x148 mm ; 4.13x5.83 in)</li>
* <li>A7 (74x105 mm ; 2.91x4.13 in)</li>
* <li>A8 (52x74 mm ; 2.05x2.91 in)</li>
* <li>A9 (37x52 mm ; 1.46x2.05 in)</li>
* <li>A10 (26x37 mm ; 1.02x1.46 in)</li>
* <li>A11 (18x26 mm ; 0.71x1.02 in)</li>
* <li>A12 (13x18 mm ; 0.51x0.71 in)</li>
* <li><b>ISO 216 B Series + 2 SIS 014711 extensions</b></li>
* <li>B0 (1000x1414 mm ; 39.37x55.67 in)</li>
* <li>B1 (707x1000 mm ; 27.83x39.37 in)</li>
* <li>B2 (500x707 mm ; 19.69x27.83 in)</li>
* <li>B3 (353x500 mm ; 13.90x19.69 in)</li>
* <li>B4 (250x353 mm ; 9.84x13.90 in)</li>
* <li>B5 (176x250 mm ; 6.93x9.84 in)</li>
* <li>B6 (125x176 mm ; 4.92x6.93 in)</li>
* <li>B7 (88x125 mm ; 3.46x4.92 in)</li>
* <li>B8 (62x88 mm ; 2.44x3.46 in)</li>
* <li>B9 (44x62 mm ; 1.73x2.44 in)</li>
* <li>B10 (31x44 mm ; 1.22x1.73 in)</li>
* <li>B11 (22x31 mm ; 0.87x1.22 in)</li>
* <li>B12 (15x22 mm ; 0.59x0.87 in)</li>
* <li><b>ISO 216 C Series + 2 SIS 014711 extensions + 2 EXTENSION</b></li>
* <li>C0 (917x1297 mm ; 36.10x51.06 in)</li>
* <li>C1 (648x917 mm ; 25.51x36.10 in)</li>
* <li>C2 (458x648 mm ; 18.03x25.51 in)</li>
* <li>C3 (324x458 mm ; 12.76x18.03 in)</li>
* <li>C4 (229x324 mm ; 9.02x12.76 in)</li>
* <li>C5 (162x229 mm ; 6.38x9.02 in)</li>
* <li>C6 (114x162 mm ; 4.49x6.38 in)</li>
* <li>C7 (81x114 mm ; 3.19x4.49 in)</li>
* <li>C8 (57x81 mm ; 2.24x3.19 in)</li>
* <li>C9 (40x57 mm ; 1.57x2.24 in)</li>
* <li>C10 (28x40 mm ; 1.10x1.57 in)</li>
* <li>C11 (20x28 mm ; 0.79x1.10 in)</li>
* <li>C12 (14x20 mm ; 0.55x0.79 in)</li>
* <li>C76 (81x162 mm ; 3.19x6.38 in)</li>
* <li>DL (110x220 mm ; 4.33x8.66 in)</li>
* <li><b>SIS 014711 E Series</b></li>
* <li>E0 (879x1241 mm ; 34.61x48.86 in)</li>
* <li>E1 (620x879 mm ; 24.41x34.61 in)</li>
* <li>E2 (440x620 mm ; 17.32x24.41 in)</li>
* <li>E3 (310x440 mm ; 12.20x17.32 in)</li>
* <li>E4 (220x310 mm ; 8.66x12.20 in)</li>
* <li>E5 (155x220 mm ; 6.10x8.66 in)</li>
* <li>E6 (110x155 mm ; 4.33x6.10 in)</li>
* <li>E7 (78x110 mm ; 3.07x4.33 in)</li>
* <li>E8 (55x78 mm ; 2.17x3.07 in)</li>
* <li>E9 (39x55 mm ; 1.54x2.17 in)</li>
* <li>E10 (27x39 mm ; 1.06x1.54 in)</li>
* <li>E11 (19x27 mm ; 0.75x1.06 in)</li>
* <li>E12 (13x19 mm ; 0.51x0.75 in)</li>
* <li><b>SIS 014711 G Series</b></li>
* <li>G0 (958x1354 mm ; 37.72x53.31 in)</li>
* <li>G1 (677x958 mm ; 26.65x37.72 in)</li>
* <li>G2 (479x677 mm ; 18.86x26.65 in)</li>
* <li>G3 (338x479 mm ; 13.31x18.86 in)</li>
* <li>G4 (239x338 mm ; 9.41x13.31 in)</li>
* <li>G5 (169x239 mm ; 6.65x9.41 in)</li>
* <li>G6 (119x169 mm ; 4.69x6.65 in)</li>
* <li>G7 (84x119 mm ; 3.31x4.69 in)</li>
* <li>G8 (59x84 mm ; 2.32x3.31 in)</li>
* <li>G9 (42x59 mm ; 1.65x2.32 in)</li>
* <li>G10 (29x42 mm ; 1.14x1.65 in)</li>
* <li>G11 (21x29 mm ; 0.83x1.14 in)</li>
* <li>G12 (14x21 mm ; 0.55x0.83 in)</li>
* <li><b>ISO Press</b></li>
* <li>RA0 (860x1220 mm ; 33.86x48.03 in)</li>
* <li>RA1 (610x860 mm ; 24.02x33.86 in)</li>
* <li>RA2 (430x610 mm ; 16.93x24.02 in)</li>
* <li>RA3 (305x430 mm ; 12.01x16.93 in)</li>
* <li>RA4 (215x305 mm ; 8.46x12.01 in)</li>
* <li>SRA0 (900x1280 mm ; 35.43x50.39 in)</li>
* <li>SRA1 (640x900 mm ; 25.20x35.43 in)</li>
* <li>SRA2 (450x640 mm ; 17.72x25.20 in)</li>
* <li>SRA3 (320x450 mm ; 12.60x17.72 in)</li>
* <li>SRA4 (225x320 mm ; 8.86x12.60 in)</li>
* <li><b>German DIN 476</b></li>
* <li>4A0 (1682x2378 mm ; 66.22x93.62 in)</li>
* <li>2A0 (1189x1682 mm ; 46.81x66.22 in)</li>
* <li><b>Variations on the ISO Standard</b></li>
* <li>A2_EXTRA (445x619 mm ; 17.52x24.37 in)</li>
* <li>A3+ (329x483 mm ; 12.95x19.02 in)</li>
* <li>A3_EXTRA (322x445 mm ; 12.68x17.52 in)</li>
* <li>A3_SUPER (305x508 mm ; 12.01x20.00 in)</li>
* <li>SUPER_A3 (305x487 mm ; 12.01x19.17 in)</li>
* <li>A4_EXTRA (235x322 mm ; 9.25x12.68 in)</li>
* <li>A4_SUPER (229x322 mm ; 9.02x12.68 in)</li>
* <li>SUPER_A4 (227x356 mm ; 8.94x14.02 in)</li>
* <li>A4_LONG (210x348 mm ; 8.27x13.70 in)</li>
* <li>F4 (210x330 mm ; 8.27x12.99 in)</li>
* <li>SO_B5_EXTRA (202x276 mm ; 7.95x10.87 in)</li>
* <li>A5_EXTRA (173x235 mm ; 6.81x9.25 in)</li>
* <li><b>ANSI Series</b></li>
* <li>ANSI_E (864x1118 mm ; 34.00x44.00 in)</li>
* <li>ANSI_D (559x864 mm ; 22.00x34.00 in)</li>
* <li>ANSI_C (432x559 mm ; 17.00x22.00 in)</li>
* <li>ANSI_B (279x432 mm ; 11.00x17.00 in)</li>
* <li>ANSI_A (216x279 mm ; 8.50x11.00 in)</li>
* <li><b>Traditional 'Loose' North American Paper Sizes</b></li>
* <li>LEDGER, USLEDGER (432x279 mm ; 17.00x11.00 in)</li>
* <li>TABLOID, USTABLOID, BIBLE, ORGANIZERK (279x432 mm ; 11.00x17.00 in)</li>
* <li>LETTER, USLETTER, ORGANIZERM (216x279 mm ; 8.50x11.00 in)</li>
* <li>LEGAL, USLEGAL (216x356 mm ; 8.50x14.00 in)</li>
* <li>GLETTER, GOVERNMENTLETTER (203x267 mm ; 8.00x10.50 in)</li>
* <li>JLEGAL, JUNIORLEGAL (203x127 mm ; 8.00x5.00 in)</li>
* <li><b>Other North American Paper Sizes</b></li>
* <li>QUADDEMY (889x1143 mm ; 35.00x45.00 in)</li>
* <li>SUPER_B (330x483 mm ; 13.00x19.00 in)</li>
* <li>QUARTO (229x279 mm ; 9.00x11.00 in)</li>
* <li>FOLIO, GOVERNMENTLEGAL (216x330 mm ; 8.50x13.00 in)</li>
* <li>EXECUTIVE, MONARCH (184x267 mm ; 7.25x10.50 in)</li>
* <li>MEMO, STATEMENT, ORGANIZERL (140x216 mm ; 5.50x8.50 in)</li>
* <li>FOOLSCAP (210x330 mm ; 8.27x13.00 in)</li>
* <li>COMPACT (108x171 mm ; 4.25x6.75 in)</li>
* <li>ORGANIZERJ (70x127 mm ; 2.75x5.00 in)</li>
* <li><b>Canadian standard CAN 2-9.60M</b></li>
* <li>P1 (560x860 mm ; 22.05x33.86 in)</li>
* <li>P2 (430x560 mm ; 16.93x22.05 in)</li>
* <li>P3 (280x430 mm ; 11.02x16.93 in)</li>
* <li>P4 (215x280 mm ; 8.46x11.02 in)</li>
* <li>P5 (140x215 mm ; 5.51x8.46 in)</li>
* <li>P6 (107x140 mm ; 4.21x5.51 in)</li>
* <li><b>North American Architectural Sizes</b></li>
* <li>ARCH_E (914x1219 mm ; 36.00x48.00 in)</li>
* <li>ARCH_E1 (762x1067 mm ; 30.00x42.00 in)</li>
* <li>ARCH_D (610x914 mm ; 24.00x36.00 in)</li>
* <li>ARCH_C, BROADSHEET (457x610 mm ; 18.00x24.00 in)</li>
* <li>ARCH_B (305x457 mm ; 12.00x18.00 in)</li>
* <li>ARCH_A (229x305 mm ; 9.00x12.00 in)</li>
* <li><b>Announcement Envelopes</b></li>
* <li>ANNENV_A2 (111x146 mm ; 4.37x5.75 in)</li>
* <li>ANNENV_A6 (121x165 mm ; 4.75x6.50 in)</li>
* <li>ANNENV_A7 (133x184 mm ; 5.25x7.25 in)</li>
* <li>ANNENV_A8 (140x206 mm ; 5.50x8.12 in)</li>
* <li>ANNENV_A10 (159x244 mm ; 6.25x9.62 in)</li>
* <li>ANNENV_SLIM (98x225 mm ; 3.87x8.87 in)</li>
* <li><b>Commercial Envelopes</b></li>
* <li>COMMENV_N6_1/4 (89x152 mm ; 3.50x6.00 in)</li>
* <li>COMMENV_N6_3/4 (92x165 mm ; 3.62x6.50 in)</li>
* <li>COMMENV_N8 (98x191 mm ; 3.87x7.50 in)</li>
* <li>COMMENV_N9 (98x225 mm ; 3.87x8.87 in)</li>
* <li>COMMENV_N10 (105x241 mm ; 4.12x9.50 in)</li>
* <li>COMMENV_N11 (114x263 mm ; 4.50x10.37 in)</li>
* <li>COMMENV_N12 (121x279 mm ; 4.75x11.00 in)</li>
* <li>COMMENV_N14 (127x292 mm ; 5.00x11.50 in)</li>
* <li><b>Catalogue Envelopes</b></li>
* <li>CATENV_N1 (152x229 mm ; 6.00x9.00 in)</li>
* <li>CATENV_N1_3/4 (165x241 mm ; 6.50x9.50 in)</li>
* <li>CATENV_N2 (165x254 mm ; 6.50x10.00 in)</li>
* <li>CATENV_N3 (178x254 mm ; 7.00x10.00 in)</li>
* <li>CATENV_N6 (191x267 mm ; 7.50x10.50 in)</li>
* <li>CATENV_N7 (203x279 mm ; 8.00x11.00 in)</li>
* <li>CATENV_N8 (210x286 mm ; 8.25x11.25 in)</li>
* <li>CATENV_N9_1/2 (216x267 mm ; 8.50x10.50 in)</li>
* <li>CATENV_N9_3/4 (222x286 mm ; 8.75x11.25 in)</li>
* <li>CATENV_N10_1/2 (229x305 mm ; 9.00x12.00 in)</li>
* <li>CATENV_N12_1/2 (241x318 mm ; 9.50x12.50 in)</li>
* <li>CATENV_N13_1/2 (254x330 mm ; 10.00x13.00 in)</li>
* <li>CATENV_N14_1/4 (286x311 mm ; 11.25x12.25 in)</li>
* <li>CATENV_N14_1/2 (292x368 mm ; 11.50x14.50 in)</li>
* <li><b>Japanese (JIS P 0138-61) Standard B-Series</b></li>
* <li>JIS_B0 (1030x1456 mm ; 40.55x57.32 in)</li>
* <li>JIS_B1 (728x1030 mm ; 28.66x40.55 in)</li>
* <li>JIS_B2 (515x728 mm ; 20.28x28.66 in)</li>
* <li>JIS_B3 (364x515 mm ; 14.33x20.28 in)</li>
* <li>JIS_B4 (257x364 mm ; 10.12x14.33 in)</li>
* <li>JIS_B5 (182x257 mm ; 7.17x10.12 in)</li>
* <li>JIS_B6 (128x182 mm ; 5.04x7.17 in)</li>
* <li>JIS_B7 (91x128 mm ; 3.58x5.04 in)</li>
* <li>JIS_B8 (64x91 mm ; 2.52x3.58 in)</li>
* <li>JIS_B9 (45x64 mm ; 1.77x2.52 in)</li>
* <li>JIS_B10 (32x45 mm ; 1.26x1.77 in)</li>
* <li>JIS_B11 (22x32 mm ; 0.87x1.26 in)</li>
* <li>JIS_B12 (16x22 mm ; 0.63x0.87 in)</li>
* <li><b>PA Series</b></li>
* <li>PA0 (840x1120 mm ; 33.07x44.09 in)</li>
* <li>PA1 (560x840 mm ; 22.05x33.07 in)</li>
* <li>PA2 (420x560 mm ; 16.54x22.05 in)</li>
* <li>PA3 (280x420 mm ; 11.02x16.54 in)</li>
* <li>PA4 (210x280 mm ; 8.27x11.02 in)</li>
* <li>PA5 (140x210 mm ; 5.51x8.27 in)</li>
* <li>PA6 (105x140 mm ; 4.13x5.51 in)</li>
* <li>PA7 (70x105 mm ; 2.76x4.13 in)</li>
* <li>PA8 (52x70 mm ; 2.05x2.76 in)</li>
* <li>PA9 (35x52 mm ; 1.38x2.05 in)</li>
* <li>PA10 (26x35 mm ; 1.02x1.38 in)</li>
* <li><b>Standard Photographic Print Sizes</b></li>
* <li>PASSPORT_PHOTO (35x45 mm ; 1.38x1.77 in)</li>
* <li>E (82x120 mm ; 3.25x4.72 in)</li>
* <li>3R, L (89x127 mm ; 3.50x5.00 in)</li>
* <li>4R, KG (102x152 mm ; 4.02x5.98 in)</li>
* <li>4D (120x152 mm ; 4.72x5.98 in)</li>
* <li>5R, 2L (127x178 mm ; 5.00x7.01 in)</li>
* <li>6R, 8P (152x203 mm ; 5.98x7.99 in)</li>
* <li>8R, 6P (203x254 mm ; 7.99x10.00 in)</li>
* <li>S8R, 6PW (203x305 mm ; 7.99x12.01 in)</li>
* <li>10R, 4P (254x305 mm ; 10.00x12.01 in)</li>
* <li>S10R, 4PW (254x381 mm ; 10.00x15.00 in)</li>
* <li>11R (279x356 mm ; 10.98x14.02 in)</li>
* <li>S11R (279x432 mm ; 10.98x17.01 in)</li>
* <li>12R (305x381 mm ; 12.01x15.00 in)</li>
* <li>S12R (305x456 mm ; 12.01x17.95 in)</li>
* <li><b>Common Newspaper Sizes</b></li>
* <li>NEWSPAPER_BROADSHEET (750x600 mm ; 29.53x23.62 in)</li>
* <li>NEWSPAPER_BERLINER (470x315 mm ; 18.50x12.40 in)</li>
* <li>NEWSPAPER_COMPACT, NEWSPAPER_TABLOID (430x280 mm ; 16.93x11.02 in)</li>
* <li><b>Business Cards</b></li>
* <li>CREDIT_CARD, BUSINESS_CARD, BUSINESS_CARD_ISO7810 (54x86 mm ; 2.13x3.37 in)</li>
* <li>BUSINESS_CARD_ISO216 (52x74 mm ; 2.05x2.91 in)</li>
* <li>BUSINESS_CARD_IT, BUSINESS_CARD_UK, BUSINESS_CARD_FR, BUSINESS_CARD_DE, BUSINESS_CARD_ES (55x85 mm ; 2.17x3.35 in)</li>
* <li>BUSINESS_CARD_US, BUSINESS_CARD_CA (51x89 mm ; 2.01x3.50 in)</li>
* <li>BUSINESS_CARD_JP (55x91 mm ; 2.17x3.58 in)</li>
* <li>BUSINESS_CARD_HK (54x90 mm ; 2.13x3.54 in)</li>
* <li>BUSINESS_CARD_AU, BUSINESS_CARD_DK, BUSINESS_CARD_SE (55x90 mm ; 2.17x3.54 in)</li>
* <li>BUSINESS_CARD_RU, BUSINESS_CARD_CZ, BUSINESS_CARD_FI, BUSINESS_CARD_HU, BUSINESS_CARD_IL (50x90 mm ; 1.97x3.54 in)</li>
* <li><b>Billboards</b></li>
* <li>4SHEET (1016x1524 mm ; 40.00x60.00 in)</li>
* <li>6SHEET (1200x1800 mm ; 47.24x70.87 in)</li>
* <li>12SHEET (3048x1524 mm ; 120.00x60.00 in)</li>
* <li>16SHEET (2032x3048 mm ; 80.00x120.00 in)</li>
* <li>32SHEET (4064x3048 mm ; 160.00x120.00 in)</li>
* <li>48SHEET (6096x3048 mm ; 240.00x120.00 in)</li>
* <li>64SHEET (8128x3048 mm ; 320.00x120.00 in)</li>
* <li>96SHEET (12192x3048 mm ; 480.00x120.00 in)</li>
* <li><b>Old Imperial English (some are still used in USA)</b></li>
* <li>EN_EMPEROR (1219x1829 mm ; 48.00x72.00 in)</li>
* <li>EN_ANTIQUARIAN (787x1346 mm ; 31.00x53.00 in)</li>
* <li>EN_GRAND_EAGLE (730x1067 mm ; 28.75x42.00 in)</li>
* <li>EN_DOUBLE_ELEPHANT (679x1016 mm ; 26.75x40.00 in)</li>
* <li>EN_ATLAS (660x864 mm ; 26.00x34.00 in)</li>
* <li>EN_COLOMBIER (597x876 mm ; 23.50x34.50 in)</li>
* <li>EN_ELEPHANT (584x711 mm ; 23.00x28.00 in)</li>
* <li>EN_DOUBLE_DEMY (572x902 mm ; 22.50x35.50 in)</li>
* <li>EN_IMPERIAL (559x762 mm ; 22.00x30.00 in)</li>
* <li>EN_PRINCESS (546x711 mm ; 21.50x28.00 in)</li>
* <li>EN_CARTRIDGE (533x660 mm ; 21.00x26.00 in)</li>
* <li>EN_DOUBLE_LARGE_POST (533x838 mm ; 21.00x33.00 in)</li>
* <li>EN_ROYAL (508x635 mm ; 20.00x25.00 in)</li>
* <li>EN_SHEET, EN_HALF_POST (495x597 mm ; 19.50x23.50 in)</li>
* <li>EN_SUPER_ROYAL (483x686 mm ; 19.00x27.00 in)</li>
* <li>EN_DOUBLE_POST (483x775 mm ; 19.00x30.50 in)</li>
* <li>EN_MEDIUM (445x584 mm ; 17.50x23.00 in)</li>
* <li>EN_DEMY (445x572 mm ; 17.50x22.50 in)</li>
* <li>EN_LARGE_POST (419x533 mm ; 16.50x21.00 in)</li>
* <li>EN_COPY_DRAUGHT (406x508 mm ; 16.00x20.00 in)</li>
* <li>EN_POST (394x489 mm ; 15.50x19.25 in)</li>
* <li>EN_CROWN (381x508 mm ; 15.00x20.00 in)</li>
* <li>EN_PINCHED_POST (375x470 mm ; 14.75x18.50 in)</li>
* <li>EN_BRIEF (343x406 mm ; 13.50x16.00 in)</li>
* <li>EN_FOOLSCAP (343x432 mm ; 13.50x17.00 in)</li>
* <li>EN_SMALL_FOOLSCAP (337x419 mm ; 13.25x16.50 in)</li>
* <li>EN_POTT (318x381 mm ; 12.50x15.00 in)</li>
* <li><b>Old Imperial Belgian</b></li>
* <li>BE_GRAND_AIGLE (700x1040 mm ; 27.56x40.94 in)</li>
* <li>BE_COLOMBIER (620x850 mm ; 24.41x33.46 in)</li>
* <li>BE_DOUBLE_CARRE (620x920 mm ; 24.41x36.22 in)</li>
* <li>BE_ELEPHANT (616x770 mm ; 24.25x30.31 in)</li>
* <li>BE_PETIT_AIGLE (600x840 mm ; 23.62x33.07 in)</li>
* <li>BE_GRAND_JESUS (550x730 mm ; 21.65x28.74 in)</li>
* <li>BE_JESUS (540x730 mm ; 21.26x28.74 in)</li>
* <li>BE_RAISIN (500x650 mm ; 19.69x25.59 in)</li>
* <li>BE_GRAND_MEDIAN (460x605 mm ; 18.11x23.82 in)</li>
* <li>BE_DOUBLE_POSTE (435x565 mm ; 17.13x22.24 in)</li>
* <li>BE_COQUILLE (430x560 mm ; 16.93x22.05 in)</li>
* <li>BE_PETIT_MEDIAN (415x530 mm ; 16.34x20.87 in)</li>
* <li>BE_RUCHE (360x460 mm ; 14.17x18.11 in)</li>
* <li>BE_PROPATRIA (345x430 mm ; 13.58x16.93 in)</li>
* <li>BE_LYS (317x397 mm ; 12.48x15.63 in)</li>
* <li>BE_POT (307x384 mm ; 12.09x15.12 in)</li>
* <li>BE_ROSETTE (270x347 mm ; 10.63x13.66 in)</li>
* <li><b>Old Imperial French</b></li>
* <li>FR_UNIVERS (1000x1300 mm ; 39.37x51.18 in)</li>
* <li>FR_DOUBLE_COLOMBIER (900x1260 mm ; 35.43x49.61 in)</li>
* <li>FR_GRANDE_MONDE (900x1260 mm ; 35.43x49.61 in)</li>
* <li>FR_DOUBLE_SOLEIL (800x1200 mm ; 31.50x47.24 in)</li>
* <li>FR_DOUBLE_JESUS (760x1120 mm ; 29.92x44.09 in)</li>
* <li>FR_GRAND_AIGLE (750x1060 mm ; 29.53x41.73 in)</li>
* <li>FR_PETIT_AIGLE (700x940 mm ; 27.56x37.01 in)</li>
* <li>FR_DOUBLE_RAISIN (650x1000 mm ; 25.59x39.37 in)</li>
* <li>FR_JOURNAL (650x940 mm ; 25.59x37.01 in)</li>
* <li>FR_COLOMBIER_AFFICHE (630x900 mm ; 24.80x35.43 in)</li>
* <li>FR_DOUBLE_CAVALIER (620x920 mm ; 24.41x36.22 in)</li>
* <li>FR_CLOCHE (600x800 mm ; 23.62x31.50 in)</li>
* <li>FR_SOLEIL (600x800 mm ; 23.62x31.50 in)</li>
* <li>FR_DOUBLE_CARRE (560x900 mm ; 22.05x35.43 in)</li>
* <li>FR_DOUBLE_COQUILLE (560x880 mm ; 22.05x34.65 in)</li>
* <li>FR_JESUS (560x760 mm ; 22.05x29.92 in)</li>
* <li>FR_RAISIN (500x650 mm ; 19.69x25.59 in)</li>
* <li>FR_CAVALIER (460x620 mm ; 18.11x24.41 in)</li>
* <li>FR_DOUBLE_COURONNE (460x720 mm ; 18.11x28.35 in)</li>
* <li>FR_CARRE (450x560 mm ; 17.72x22.05 in)</li>
* <li>FR_COQUILLE (440x560 mm ; 17.32x22.05 in)</li>
* <li>FR_DOUBLE_TELLIERE (440x680 mm ; 17.32x26.77 in)</li>
* <li>FR_DOUBLE_CLOCHE (400x600 mm ; 15.75x23.62 in)</li>
* <li>FR_DOUBLE_POT (400x620 mm ; 15.75x24.41 in)</li>
* <li>FR_ECU (400x520 mm ; 15.75x20.47 in)</li>
* <li>FR_COURONNE (360x460 mm ; 14.17x18.11 in)</li>
* <li>FR_TELLIERE (340x440 mm ; 13.39x17.32 in)</li>
* <li>FR_POT (310x400 mm ; 12.20x15.75 in)</li>
* </ul>
* @return array containing page width and height in points
* @since 5.0.010 (2010-05-17)
* @public static
*/
public static function getPageSizeFromFormat($format) {
// Paper cordinates are calculated in this way: (inches * 72) where (1 inch = 25.4 mm)
switch (strtoupper($format)) {
// ISO 216 A Series + 2 SIS 014711 extensions
case 'A0' : {$pf = array( 2383.937, 3370.394); break;}
case 'A1' : {$pf = array( 1683.780, 2383.937); break;}
case 'A2' : {$pf = array( 1190.551, 1683.780); break;}
case 'A3' : {$pf = array( 841.890, 1190.551); break;}
case 'A4' : {$pf = array( 595.276, 841.890); break;}
case 'A5' : {$pf = array( 419.528, 595.276); break;}
case 'A6' : {$pf = array( 297.638, 419.528); break;}
case 'A7' : {$pf = array( 209.764, 297.638); break;}
case 'A8' : {$pf = array( 147.402, 209.764); break;}
case 'A9' : {$pf = array( 104.882, 147.402); break;}
case 'A10': {$pf = array( 73.701, 104.882); break;}
case 'A11': {$pf = array( 51.024, 73.701); break;}
case 'A12': {$pf = array( 36.850, 51.024); break;}
// ISO 216 B Series + 2 SIS 014711 extensions
case 'B0' : {$pf = array( 2834.646, 4008.189); break;}
case 'B1' : {$pf = array( 2004.094, 2834.646); break;}
case 'B2' : {$pf = array( 1417.323, 2004.094); break;}
case 'B3' : {$pf = array( 1000.630, 1417.323); break;}
case 'B4' : {$pf = array( 708.661, 1000.630); break;}
case 'B5' : {$pf = array( 498.898, 708.661); break;}
case 'B6' : {$pf = array( 354.331, 498.898); break;}
case 'B7' : {$pf = array( 249.449, 354.331); break;}
case 'B8' : {$pf = array( 175.748, 249.449); break;}
case 'B9' : {$pf = array( 124.724, 175.748); break;}
case 'B10': {$pf = array( 87.874, 124.724); break;}
case 'B11': {$pf = array( 62.362, 87.874); break;}
case 'B12': {$pf = array( 42.520, 62.362); break;}
// ISO 216 C Series + 2 SIS 014711 extensions + 2 EXTENSION
case 'C0' : {$pf = array( 2599.370, 3676.535); break;}
case 'C1' : {$pf = array( 1836.850, 2599.370); break;}
case 'C2' : {$pf = array( 1298.268, 1836.850); break;}
case 'C3' : {$pf = array( 918.425, 1298.268); break;}
case 'C4' : {$pf = array( 649.134, 918.425); break;}
case 'C5' : {$pf = array( 459.213, 649.134); break;}
case 'C6' : {$pf = array( 323.150, 459.213); break;}
case 'C7' : {$pf = array( 229.606, 323.150); break;}
case 'C8' : {$pf = array( 161.575, 229.606); break;}
case 'C9' : {$pf = array( 113.386, 161.575); break;}
case 'C10': {$pf = array( 79.370, 113.386); break;}
case 'C11': {$pf = array( 56.693, 79.370); break;}
case 'C12': {$pf = array( 39.685, 56.693); break;}
case 'C76': {$pf = array( 229.606, 459.213); break;}
case 'DL' : {$pf = array( 311.811, 623.622); break;}
// SIS 014711 E Series
case 'E0' : {$pf = array( 2491.654, 3517.795); break;}
case 'E1' : {$pf = array( 1757.480, 2491.654); break;}
case 'E2' : {$pf = array( 1247.244, 1757.480); break;}
case 'E3' : {$pf = array( 878.740, 1247.244); break;}
case 'E4' : {$pf = array( 623.622, 878.740); break;}
case 'E5' : {$pf = array( 439.370, 623.622); break;}
case 'E6' : {$pf = array( 311.811, 439.370); break;}
case 'E7' : {$pf = array( 221.102, 311.811); break;}
case 'E8' : {$pf = array( 155.906, 221.102); break;}
case 'E9' : {$pf = array( 110.551, 155.906); break;}
case 'E10': {$pf = array( 76.535, 110.551); break;}
case 'E11': {$pf = array( 53.858, 76.535); break;}
case 'E12': {$pf = array( 36.850, 53.858); break;}
// SIS 014711 G Series
case 'G0' : {$pf = array( 2715.591, 3838.110); break;}
case 'G1' : {$pf = array( 1919.055, 2715.591); break;}
case 'G2' : {$pf = array( 1357.795, 1919.055); break;}
case 'G3' : {$pf = array( 958.110, 1357.795); break;}
case 'G4' : {$pf = array( 677.480, 958.110); break;}
case 'G5' : {$pf = array( 479.055, 677.480); break;}
case 'G6' : {$pf = array( 337.323, 479.055); break;}
case 'G7' : {$pf = array( 238.110, 337.323); break;}
case 'G8' : {$pf = array( 167.244, 238.110); break;}
case 'G9' : {$pf = array( 119.055, 167.244); break;}
case 'G10': {$pf = array( 82.205, 119.055); break;}
case 'G11': {$pf = array( 59.528, 82.205); break;}
case 'G12': {$pf = array( 39.685, 59.528); break;}
// ISO Press
case 'RA0': {$pf = array( 2437.795, 3458.268); break;}
case 'RA1': {$pf = array( 1729.134, 2437.795); break;}
case 'RA2': {$pf = array( 1218.898, 1729.134); break;}
case 'RA3': {$pf = array( 864.567, 1218.898); break;}
case 'RA4': {$pf = array( 609.449, 864.567); break;}
case 'SRA0': {$pf = array( 2551.181, 3628.346); break;}
case 'SRA1': {$pf = array( 1814.173, 2551.181); break;}
case 'SRA2': {$pf = array( 1275.591, 1814.173); break;}
case 'SRA3': {$pf = array( 907.087, 1275.591); break;}
case 'SRA4': {$pf = array( 637.795, 907.087); break;}
// German DIN 476
case '4A0': {$pf = array( 4767.874, 6740.787); break;}
case '2A0': {$pf = array( 3370.394, 4767.874); break;}
// Variations on the ISO Standard
case 'A2_EXTRA' : {$pf = array( 1261.417, 1754.646); break;}
case 'A3+' : {$pf = array( 932.598, 1369.134); break;}
case 'A3_EXTRA' : {$pf = array( 912.756, 1261.417); break;}
case 'A3_SUPER' : {$pf = array( 864.567, 1440.000); break;}
case 'SUPER_A3' : {$pf = array( 864.567, 1380.472); break;}
case 'A4_EXTRA' : {$pf = array( 666.142, 912.756); break;}
case 'A4_SUPER' : {$pf = array( 649.134, 912.756); break;}
case 'SUPER_A4' : {$pf = array( 643.465, 1009.134); break;}
case 'A4_LONG' : {$pf = array( 595.276, 986.457); break;}
case 'F4' : {$pf = array( 595.276, 935.433); break;}
case 'SO_B5_EXTRA': {$pf = array( 572.598, 782.362); break;}
case 'A5_EXTRA' : {$pf = array( 490.394, 666.142); break;}
// ANSI Series
case 'ANSI_E': {$pf = array( 2448.000, 3168.000); break;}
case 'ANSI_D': {$pf = array( 1584.000, 2448.000); break;}
case 'ANSI_C': {$pf = array( 1224.000, 1584.000); break;}
case 'ANSI_B': {$pf = array( 792.000, 1224.000); break;}
case 'ANSI_A': {$pf = array( 612.000, 792.000); break;}
// Traditional 'Loose' North American Paper Sizes
case 'USLEDGER':
case 'LEDGER' : {$pf = array( 1224.000, 792.000); break;}
case 'ORGANIZERK':
case 'BIBLE':
case 'USTABLOID':
case 'TABLOID': {$pf = array( 792.000, 1224.000); break;}
case 'ORGANIZERM':
case 'USLETTER':
case 'LETTER' : {$pf = array( 612.000, 792.000); break;}
case 'USLEGAL':
case 'LEGAL' : {$pf = array( 612.000, 1008.000); break;}
case 'GOVERNMENTLETTER':
case 'GLETTER': {$pf = array( 576.000, 756.000); break;}
case 'JUNIORLEGAL':
case 'JLEGAL' : {$pf = array( 576.000, 360.000); break;}
// Other North American Paper Sizes
case 'QUADDEMY': {$pf = array( 2520.000, 3240.000); break;}
case 'SUPER_B': {$pf = array( 936.000, 1368.000); break;}
case 'QUARTO': {$pf = array( 648.000, 792.000); break;}
case 'GOVERNMENTLEGAL':
case 'FOLIO': {$pf = array( 612.000, 936.000); break;}
case 'MONARCH':
case 'EXECUTIVE': {$pf = array( 522.000, 756.000); break;}
case 'ORGANIZERL':
case 'STATEMENT':
case 'MEMO': {$pf = array( 396.000, 612.000); break;}
case 'FOOLSCAP': {$pf = array( 595.440, 936.000); break;}
case 'COMPACT': {$pf = array( 306.000, 486.000); break;}
case 'ORGANIZERJ': {$pf = array( 198.000, 360.000); break;}
// Canadian standard CAN 2-9.60M
case 'P1': {$pf = array( 1587.402, 2437.795); break;}
case 'P2': {$pf = array( 1218.898, 1587.402); break;}
case 'P3': {$pf = array( 793.701, 1218.898); break;}
case 'P4': {$pf = array( 609.449, 793.701); break;}
case 'P5': {$pf = array( 396.850, 609.449); break;}
case 'P6': {$pf = array( 303.307, 396.850); break;}
// North American Architectural Sizes
case 'ARCH_E' : {$pf = array( 2592.000, 3456.000); break;}
case 'ARCH_E1': {$pf = array( 2160.000, 3024.000); break;}
case 'ARCH_D' : {$pf = array( 1728.000, 2592.000); break;}
case 'BROADSHEET':
case 'ARCH_C' : {$pf = array( 1296.000, 1728.000); break;}
case 'ARCH_B' : {$pf = array( 864.000, 1296.000); break;}
case 'ARCH_A' : {$pf = array( 648.000, 864.000); break;}
// --- North American Envelope Sizes ---
// - Announcement Envelopes
case 'ANNENV_A2' : {$pf = array( 314.640, 414.000); break;}
case 'ANNENV_A6' : {$pf = array( 342.000, 468.000); break;}
case 'ANNENV_A7' : {$pf = array( 378.000, 522.000); break;}
case 'ANNENV_A8' : {$pf = array( 396.000, 584.640); break;}
case 'ANNENV_A10' : {$pf = array( 450.000, 692.640); break;}
case 'ANNENV_SLIM': {$pf = array( 278.640, 638.640); break;}
// - Commercial Envelopes
case 'COMMENV_N6_1/4': {$pf = array( 252.000, 432.000); break;}
case 'COMMENV_N6_3/4': {$pf = array( 260.640, 468.000); break;}
case 'COMMENV_N8' : {$pf = array( 278.640, 540.000); break;}
case 'COMMENV_N9' : {$pf = array( 278.640, 638.640); break;}
case 'COMMENV_N10' : {$pf = array( 296.640, 684.000); break;}
case 'COMMENV_N11' : {$pf = array( 324.000, 746.640); break;}
case 'COMMENV_N12' : {$pf = array( 342.000, 792.000); break;}
case 'COMMENV_N14' : {$pf = array( 360.000, 828.000); break;}
// - Catalogue Envelopes
case 'CATENV_N1' : {$pf = array( 432.000, 648.000); break;}
case 'CATENV_N1_3/4' : {$pf = array( 468.000, 684.000); break;}
case 'CATENV_N2' : {$pf = array( 468.000, 720.000); break;}
case 'CATENV_N3' : {$pf = array( 504.000, 720.000); break;}
case 'CATENV_N6' : {$pf = array( 540.000, 756.000); break;}
case 'CATENV_N7' : {$pf = array( 576.000, 792.000); break;}
case 'CATENV_N8' : {$pf = array( 594.000, 810.000); break;}
case 'CATENV_N9_1/2' : {$pf = array( 612.000, 756.000); break;}
case 'CATENV_N9_3/4' : {$pf = array( 630.000, 810.000); break;}
case 'CATENV_N10_1/2': {$pf = array( 648.000, 864.000); break;}
case 'CATENV_N12_1/2': {$pf = array( 684.000, 900.000); break;}
case 'CATENV_N13_1/2': {$pf = array( 720.000, 936.000); break;}
case 'CATENV_N14_1/4': {$pf = array( 810.000, 882.000); break;}
case 'CATENV_N14_1/2': {$pf = array( 828.000, 1044.000); break;}
// Japanese (JIS P 0138-61) Standard B-Series
case 'JIS_B0' : {$pf = array( 2919.685, 4127.244); break;}
case 'JIS_B1' : {$pf = array( 2063.622, 2919.685); break;}
case 'JIS_B2' : {$pf = array( 1459.843, 2063.622); break;}
case 'JIS_B3' : {$pf = array( 1031.811, 1459.843); break;}
case 'JIS_B4' : {$pf = array( 728.504, 1031.811); break;}
case 'JIS_B5' : {$pf = array( 515.906, 728.504); break;}
case 'JIS_B6' : {$pf = array( 362.835, 515.906); break;}
case 'JIS_B7' : {$pf = array( 257.953, 362.835); break;}
case 'JIS_B8' : {$pf = array( 181.417, 257.953); break;}
case 'JIS_B9' : {$pf = array( 127.559, 181.417); break;}
case 'JIS_B10': {$pf = array( 90.709, 127.559); break;}
case 'JIS_B11': {$pf = array( 62.362, 90.709); break;}
case 'JIS_B12': {$pf = array( 45.354, 62.362); break;}
// PA Series
case 'PA0' : {$pf = array( 2381.102, 3174.803,); break;}
case 'PA1' : {$pf = array( 1587.402, 2381.102); break;}
case 'PA2' : {$pf = array( 1190.551, 1587.402); break;}
case 'PA3' : {$pf = array( 793.701, 1190.551); break;}
case 'PA4' : {$pf = array( 595.276, 793.701); break;}
case 'PA5' : {$pf = array( 396.850, 595.276); break;}
case 'PA6' : {$pf = array( 297.638, 396.850); break;}
case 'PA7' : {$pf = array( 198.425, 297.638); break;}
case 'PA8' : {$pf = array( 147.402, 198.425); break;}
case 'PA9' : {$pf = array( 99.213, 147.402); break;}
case 'PA10': {$pf = array( 73.701, 99.213); break;}
// Standard Photographic Print Sizes
case 'PASSPORT_PHOTO': {$pf = array( 99.213, 127.559); break;}
case 'E' : {$pf = array( 233.858, 340.157); break;}
case 'L':
case '3R' : {$pf = array( 252.283, 360.000); break;}
case 'KG':
case '4R' : {$pf = array( 289.134, 430.866); break;}
case '4D' : {$pf = array( 340.157, 430.866); break;}
case '2L':
case '5R' : {$pf = array( 360.000, 504.567); break;}
case '8P':
case '6R' : {$pf = array( 430.866, 575.433); break;}
case '6P':
case '8R' : {$pf = array( 575.433, 720.000); break;}
case '6PW':
case 'S8R' : {$pf = array( 575.433, 864.567); break;}
case '4P':
case '10R' : {$pf = array( 720.000, 864.567); break;}
case '4PW':
case 'S10R': {$pf = array( 720.000, 1080.000); break;}
case '11R' : {$pf = array( 790.866, 1009.134); break;}
case 'S11R': {$pf = array( 790.866, 1224.567); break;}
case '12R' : {$pf = array( 864.567, 1080.000); break;}
case 'S12R': {$pf = array( 864.567, 1292.598); break;}
// Common Newspaper Sizes
case 'NEWSPAPER_BROADSHEET': {$pf = array( 2125.984, 1700.787); break;}
case 'NEWSPAPER_BERLINER' : {$pf = array( 1332.283, 892.913); break;}
case 'NEWSPAPER_TABLOID':
case 'NEWSPAPER_COMPACT' : {$pf = array( 1218.898, 793.701); break;}
// Business Cards
case 'CREDIT_CARD':
case 'BUSINESS_CARD':
case 'BUSINESS_CARD_ISO7810': {$pf = array( 153.014, 242.646); break;}
case 'BUSINESS_CARD_ISO216' : {$pf = array( 147.402, 209.764); break;}
case 'BUSINESS_CARD_IT':
case 'BUSINESS_CARD_UK':
case 'BUSINESS_CARD_FR':
case 'BUSINESS_CARD_DE':
case 'BUSINESS_CARD_ES' : {$pf = array( 155.906, 240.945); break;}
case 'BUSINESS_CARD_CA':
case 'BUSINESS_CARD_US' : {$pf = array( 144.567, 252.283); break;}
case 'BUSINESS_CARD_JP' : {$pf = array( 155.906, 257.953); break;}
case 'BUSINESS_CARD_HK' : {$pf = array( 153.071, 255.118); break;}
case 'BUSINESS_CARD_AU':
case 'BUSINESS_CARD_DK':
case 'BUSINESS_CARD_SE' : {$pf = array( 155.906, 255.118); break;}
case 'BUSINESS_CARD_RU':
case 'BUSINESS_CARD_CZ':
case 'BUSINESS_CARD_FI':
case 'BUSINESS_CARD_HU':
case 'BUSINESS_CARD_IL' : {$pf = array( 141.732, 255.118); break;}
// Billboards
case '4SHEET' : {$pf = array( 2880.000, 4320.000); break;}
case '6SHEET' : {$pf = array( 3401.575, 5102.362); break;}
case '12SHEET': {$pf = array( 8640.000, 4320.000); break;}
case '16SHEET': {$pf = array( 5760.000, 8640.000); break;}
case '32SHEET': {$pf = array(11520.000, 8640.000); break;}
case '48SHEET': {$pf = array(17280.000, 8640.000); break;}
case '64SHEET': {$pf = array(23040.000, 8640.000); break;}
case '96SHEET': {$pf = array(34560.000, 8640.000); break;}
// Old European Sizes
// - Old Imperial English Sizes
case 'EN_EMPEROR' : {$pf = array( 3456.000, 5184.000); break;}
case 'EN_ANTIQUARIAN' : {$pf = array( 2232.000, 3816.000); break;}
case 'EN_GRAND_EAGLE' : {$pf = array( 2070.000, 3024.000); break;}
case 'EN_DOUBLE_ELEPHANT' : {$pf = array( 1926.000, 2880.000); break;}
case 'EN_ATLAS' : {$pf = array( 1872.000, 2448.000); break;}
case 'EN_COLOMBIER' : {$pf = array( 1692.000, 2484.000); break;}
case 'EN_ELEPHANT' : {$pf = array( 1656.000, 2016.000); break;}
case 'EN_DOUBLE_DEMY' : {$pf = array( 1620.000, 2556.000); break;}
case 'EN_IMPERIAL' : {$pf = array( 1584.000, 2160.000); break;}
case 'EN_PRINCESS' : {$pf = array( 1548.000, 2016.000); break;}
case 'EN_CARTRIDGE' : {$pf = array( 1512.000, 1872.000); break;}
case 'EN_DOUBLE_LARGE_POST': {$pf = array( 1512.000, 2376.000); break;}
case 'EN_ROYAL' : {$pf = array( 1440.000, 1800.000); break;}
case 'EN_SHEET':
case 'EN_HALF_POST' : {$pf = array( 1404.000, 1692.000); break;}
case 'EN_SUPER_ROYAL' : {$pf = array( 1368.000, 1944.000); break;}
case 'EN_DOUBLE_POST' : {$pf = array( 1368.000, 2196.000); break;}
case 'EN_MEDIUM' : {$pf = array( 1260.000, 1656.000); break;}
case 'EN_DEMY' : {$pf = array( 1260.000, 1620.000); break;}
case 'EN_LARGE_POST' : {$pf = array( 1188.000, 1512.000); break;}
case 'EN_COPY_DRAUGHT' : {$pf = array( 1152.000, 1440.000); break;}
case 'EN_POST' : {$pf = array( 1116.000, 1386.000); break;}
case 'EN_CROWN' : {$pf = array( 1080.000, 1440.000); break;}
case 'EN_PINCHED_POST' : {$pf = array( 1062.000, 1332.000); break;}
case 'EN_BRIEF' : {$pf = array( 972.000, 1152.000); break;}
case 'EN_FOOLSCAP' : {$pf = array( 972.000, 1224.000); break;}
case 'EN_SMALL_FOOLSCAP' : {$pf = array( 954.000, 1188.000); break;}
case 'EN_POTT' : {$pf = array( 900.000, 1080.000); break;}
// - Old Imperial Belgian Sizes
case 'BE_GRAND_AIGLE' : {$pf = array( 1984.252, 2948.031); break;}
case 'BE_COLOMBIER' : {$pf = array( 1757.480, 2409.449); break;}
case 'BE_DOUBLE_CARRE': {$pf = array( 1757.480, 2607.874); break;}
case 'BE_ELEPHANT' : {$pf = array( 1746.142, 2182.677); break;}
case 'BE_PETIT_AIGLE' : {$pf = array( 1700.787, 2381.102); break;}
case 'BE_GRAND_JESUS' : {$pf = array( 1559.055, 2069.291); break;}
case 'BE_JESUS' : {$pf = array( 1530.709, 2069.291); break;}
case 'BE_RAISIN' : {$pf = array( 1417.323, 1842.520); break;}
case 'BE_GRAND_MEDIAN': {$pf = array( 1303.937, 1714.961); break;}
case 'BE_DOUBLE_POSTE': {$pf = array( 1233.071, 1601.575); break;}
case 'BE_COQUILLE' : {$pf = array( 1218.898, 1587.402); break;}
case 'BE_PETIT_MEDIAN': {$pf = array( 1176.378, 1502.362); break;}
case 'BE_RUCHE' : {$pf = array( 1020.472, 1303.937); break;}
case 'BE_PROPATRIA' : {$pf = array( 977.953, 1218.898); break;}
case 'BE_LYS' : {$pf = array( 898.583, 1125.354); break;}
case 'BE_POT' : {$pf = array( 870.236, 1088.504); break;}
case 'BE_ROSETTE' : {$pf = array( 765.354, 983.622); break;}
// - Old Imperial French Sizes
case 'FR_UNIVERS' : {$pf = array( 2834.646, 3685.039); break;}
case 'FR_DOUBLE_COLOMBIER' : {$pf = array( 2551.181, 3571.654); break;}
case 'FR_GRANDE_MONDE' : {$pf = array( 2551.181, 3571.654); break;}
case 'FR_DOUBLE_SOLEIL' : {$pf = array( 2267.717, 3401.575); break;}
case 'FR_DOUBLE_JESUS' : {$pf = array( 2154.331, 3174.803); break;}
case 'FR_GRAND_AIGLE' : {$pf = array( 2125.984, 3004.724); break;}
case 'FR_PETIT_AIGLE' : {$pf = array( 1984.252, 2664.567); break;}
case 'FR_DOUBLE_RAISIN' : {$pf = array( 1842.520, 2834.646); break;}
case 'FR_JOURNAL' : {$pf = array( 1842.520, 2664.567); break;}
case 'FR_COLOMBIER_AFFICHE': {$pf = array( 1785.827, 2551.181); break;}
case 'FR_DOUBLE_CAVALIER' : {$pf = array( 1757.480, 2607.874); break;}
case 'FR_CLOCHE' : {$pf = array( 1700.787, 2267.717); break;}
case 'FR_SOLEIL' : {$pf = array( 1700.787, 2267.717); break;}
case 'FR_DOUBLE_CARRE' : {$pf = array( 1587.402, 2551.181); break;}
case 'FR_DOUBLE_COQUILLE' : {$pf = array( 1587.402, 2494.488); break;}
case 'FR_JESUS' : {$pf = array( 1587.402, 2154.331); break;}
case 'FR_RAISIN' : {$pf = array( 1417.323, 1842.520); break;}
case 'FR_CAVALIER' : {$pf = array( 1303.937, 1757.480); break;}
case 'FR_DOUBLE_COURONNE' : {$pf = array( 1303.937, 2040.945); break;}
case 'FR_CARRE' : {$pf = array( 1275.591, 1587.402); break;}
case 'FR_COQUILLE' : {$pf = array( 1247.244, 1587.402); break;}
case 'FR_DOUBLE_TELLIERE' : {$pf = array( 1247.244, 1927.559); break;}
case 'FR_DOUBLE_CLOCHE' : {$pf = array( 1133.858, 1700.787); break;}
case 'FR_DOUBLE_POT' : {$pf = array( 1133.858, 1757.480); break;}
case 'FR_ECU' : {$pf = array( 1133.858, 1474.016); break;}
case 'FR_COURONNE' : {$pf = array( 1020.472, 1303.937); break;}
case 'FR_TELLIERE' : {$pf = array( 963.780, 1247.244); break;}
case 'FR_POT' : {$pf = array( 878.740, 1133.858); break;}
// DEFAULT ISO A4
default: {$pf = array( 595.276, 841.890); break;}
}
return $pf;
}
/**
* Set page boundaries.
* @param $page (int) page number
* @param $type (string) valid values are: <ul><li>'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;</li><li>'CropBox' : the visible region of default user space;</li><li>'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;</li><li>'TrimBox' : the intended dimensions of the finished page after trimming;</li><li>'ArtBox' : the page's meaningful content (including potential white space).</li></ul>
* @param $llx (float) lower-left x coordinate in user units.
* @param $lly (float) lower-left y coordinate in user units.
* @param $urx (float) upper-right x coordinate in user units.
* @param $ury (float) upper-right y coordinate in user units.
* @param $points (boolean) If true uses user units as unit of measure, otherwise uses PDF points.
* @param $k (float) Scale factor (number of points in user unit).
* @param $pagedim (array) Array of page dimensions.
* @return pagedim array of page dimensions.
* @since 5.0.010 (2010-05-17)
* @public static
*/
public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array()) {
if (!isset($pagedim[$page])) {
// initialize array
$pagedim[$page] = array();
}
if (!in_array($type, self::$pageboxes)) {
return;
}
if ($points) {
$k = 1;
}
$pagedim[$page][$type]['llx'] = ($llx * $k);
$pagedim[$page][$type]['lly'] = ($lly * $k);
$pagedim[$page][$type]['urx'] = ($urx * $k);
$pagedim[$page][$type]['ury'] = ($ury * $k);
return $pagedim;
}
/**
* Swap X and Y coordinates of page boxes (change page boxes orientation).
* @param $page (int) page number
* @param $pagedim (array) Array of page dimensions.
* @return pagedim array of page dimensions.
* @since 5.0.010 (2010-05-17)
* @public static
*/
public static function swapPageBoxCoordinates($page, $pagedim) {
foreach (self::$pageboxes as $type) {
// swap X and Y coordinates
if (isset($pagedim[$page][$type])) {
$tmp = $pagedim[$page][$type]['llx'];
$pagedim[$page][$type]['llx'] = $pagedim[$page][$type]['lly'];
$pagedim[$page][$type]['lly'] = $tmp;
$tmp = $pagedim[$page][$type]['urx'];
$pagedim[$page][$type]['urx'] = $pagedim[$page][$type]['ury'];
$pagedim[$page][$type]['ury'] = $tmp;
}
}
return $pagedim;
}
/**
* Get the canonical page layout mode.
* @param $layout (string) The page layout. Possible values are:<ul><li>SinglePage Display one page at a time</li><li>OneColumn Display the pages in one column</li><li>TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left</li><li>TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right</li><li>TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left</li><li>TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right</li></ul>
* @return (string) Canonical page layout name.
* @public static
*/
public static function getPageLayoutMode($layout='SinglePage') {
switch ($layout) {
case 'default':
case 'single':
case 'SinglePage': {
$layout_mode = 'SinglePage';
break;
}
case 'continuous':
case 'OneColumn': {
$layout_mode = 'OneColumn';
break;
}
case 'two':
case 'TwoColumnLeft': {
$layout_mode = 'TwoColumnLeft';
break;
}
case 'TwoColumnRight': {
$layout_mode = 'TwoColumnRight';
break;
}
case 'TwoPageLeft': {
$layout_mode = 'TwoPageLeft';
break;
}
case 'TwoPageRight': {
$layout_mode = 'TwoPageRight';
break;
}
default: {
$layout_mode = 'SinglePage';
}
}
return $layout_mode;
}
/**
* Get the canonical page layout mode.
* @param $mode (string) A name object specifying how the document should be displayed when opened:<ul><li>UseNone Neither document outline nor thumbnail images visible</li><li>UseOutlines Document outline visible</li><li>UseThumbs Thumbnail images visible</li><li>FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible</li><li>UseOC (PDF 1.5) Optional content group panel visible</li><li>UseAttachments (PDF 1.6) Attachments panel visible</li></ul>
* @return (string) Canonical page mode name.
* @public static
*/
public static function getPageMode($mode='UseNone') {
switch ($mode) {
case 'UseNone': {
$page_mode = 'UseNone';
break;
}
case 'UseOutlines': {
$page_mode = 'UseOutlines';
break;
}
case 'UseThumbs': {
$page_mode = 'UseThumbs';
break;
}
case 'FullScreen': {
$page_mode = 'FullScreen';
break;
}
case 'UseOC': {
$page_mode = 'UseOC';
break;
}
case '': {
$page_mode = 'UseAttachments';
break;
}
default: {
$page_mode = 'UseNone';
}
}
return $page_mode;
}
/**
* Check if the URL exist.
* @param $url (string) URL to check.
* @return Boolean true if the URl exist, false otherwise.
* @since 5.9.204 (2013-01-28)
* @public static
*/
public static function isValidURL($url) {
$headers = @get_headers($url);
return (strpos($headers[0], '200') !== false);
}
/**
* Removes SHY characters from text.
* Unicode Data:<ul>
* <li>Name : SOFT HYPHEN, commonly abbreviated as SHY</li>
* <li>HTML Entity (decimal): "&#173;"</li>
* <li>HTML Entity (hex): "&#xad;"</li>
* <li>HTML Entity (named): "&shy;"</li>
* <li>How to type in Microsoft Windows: [Alt +00AD] or [Alt 0173]</li>
* <li>UTF-8 (hex): 0xC2 0xAD (c2ad)</li>
* <li>UTF-8 character: chr(194).chr(173)</li>
* </ul>
* @param $txt (string) input string
* @param $unicode (boolean) True if we are in unicode mode, false otherwise.
* @return string without SHY characters.
* @since (4.5.019) 2009-02-28
* @public static
*/
public static function removeSHY($txt='', $unicode=true) {
$txt = preg_replace('/([\\xc2]{1}[\\xad]{1})/', '', $txt);