| @@ -1,32 +1,51 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -// mPDF 5.4 | |
| 4 | -// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased | |
| 5 | -// executon time and disk access (read and write) | |
| 6 | -$this->cacheTables = false; | |
| 3 | +// mPDF 5.7 | |
| 4 | +// Specify whether to automatically generate bookmarks or ToC entries from h1 - h6 tags | |
| 5 | +$this->h2bookmarks = array(); | |
| 6 | +$this->h2toc = array(); | |
| 7 | +/* Define arrays with e.g. the tag=>ToC-level | |
| 8 | +Remember bookmark and ToC levels start at 0 | |
| 9 | +(does not work inside tables) | |
| 10 | +Only the default ToC will be used if > 1 ToCs are defined for the document | |
| 11 | +H1 - H6 must be uppercase | |
| 12 | +$this->h2toc = array('H1'=>0, 'H2'=>1, 'H3'=>2); | |
| 13 | +$this->h2bookmarks = array('H1'=>0, 'H2'=>1, 'H3'=>2); | |
| 14 | +*/ | |
| 7 | 15 | |
| 8 | -// Set an optional array to specify appearance of Bookmarks (by level) | |
| 9 | -// Default values are Black and normal style | |
| 10 | -/* | |
| 11 | - Example: | |
| 12 | -$this->bookmarkStyles = array( | |
| 13 | - 0 => array('color'=> array(0,64,128), 'style'=>'B'), | |
| 14 | - 1 => array('color'=> array(128,0,0), 'style'=>''), | |
| 15 | - 2 => array('color'=> array(0,128,0), 'style'=>'I'), | |
| 16 | -); | |
| 17 | -*/ | |
| 18 | -$this->bookmarkStyles = array(); | |
| 16 | +// mPDF 5.7 | |
| 17 | +// Text-align on decimal marks | |
| 18 | +// Allowed characters for alignment on decimal marks. Additional codes must start with D | |
| 19 | +// Non-ASCII characters should be in utf-8 encoding | |
| 20 | +// DM - middot U+00B7 | |
| 21 | +// DA - arabic decimal mark U+066B | |
| 22 | +$this->decimal_align = array('DP'=>'.', 'DC'=>',', 'DM'=>"\xc2\xb7", 'DA'=>"\xd9\xab", 'DD'=>'-'); | |
| 19 | 23 | |
| 20 | -// ACTIVE FORMS | |
| 21 | -$this->useActiveForms = false; | |
| 24 | +// PAGING | |
| 25 | +$this->mirrorMargins = 0; | |
| 26 | +$this->restoreBlockPagebreaks = false; | |
| 27 | +$this->forcePortraitMargins = false; | |
| 28 | +$this->displayDefaultOrientation = false; | |
| 29 | +$this->printers_info = false; // Adds date and page info for printer when using @page and "marks:crop;" | |
| 30 | +$this->bleedMargin = 5; | |
| 31 | +$this->crossMarkMargin = 5; // Distance of cross mark from margin in mm | |
| 32 | +$this->cropMarkMargin = 8; // Distance of crop mark from margin in mm | |
| 33 | +$this->cropMarkLength = 18; // Default length in mm of crop line | |
| 34 | +$this->nonPrintMargin = 8; // Non-printable border at edge of paper sheet in mm | |
| 35 | +// mPDF 5.5 | |
| 36 | +// Avoid just the border/background-color of the end of a block being moved on to next page | |
| 37 | +$this->margBuffer = 2; // Allows an (empty) end of block to extend beyond the bottom margin by this amount (mm) | |
| 22 | 38 | |
| 23 | -// When embedding full TTF font files, remakes the font file using only core tables | |
| 24 | -// May improve function with some PostScript printers (GhostScript/GSView) | |
| 25 | -// Does not work with TTC font collections | |
| 26 | -// Slightly smaller file; increased processing time | |
| 27 | -$this->repackageTTF = false; | |
| 28 | 39 | |
| 40 | +// PAGE NUMBERING | |
| 41 | +$this->pagenumPrefix; | |
| 42 | +$this->pagenumSuffix; | |
| 43 | +$this->nbpgPrefix; | |
| 44 | +$this->nbpgSuffix; | |
| 45 | + | |
| 46 | + | |
| 47 | +// FONTS, LANGUAGES & CHARACTER SETS | |
| 29 | 48 | // Set maximum size of TTF font file to allow non-subsets - in kB |
| 30 | 49 | // Used to avoid e.g. Arial Unicode MS (perhaps used for substitutions) to ever be fully embedded |
| 31 | 50 | // NB Free serif is 1.5MB, most files are <= 600kB (most 200-400KB) |
| 32 | 51 | $this->maxTTFFilesize = 2000; |
| @@ -45,36 +64,14 @@ | ||
| 45 | 64 | // default TRUE; only set false if you have defined some available fonts that support CJK |
| 46 | 65 | // If true this will not stop use of other CJK fonts if specified by font-family: |
| 47 | 66 | // and vice versa i.e. only dictates behaviour when specified by lang="" incl. AutoFont() |
| 48 | 67 | |
| 68 | +// When embedding full TTF font files, remakes the font file using only core tables | |
| 69 | +// May improve function with some PostScript printers (GhostScript/GSView) | |
| 70 | +// Does not work with TTC font collections | |
| 71 | +// Slightly smaller file; increased processing time | |
| 72 | +$this->repackageTTF = false; | |
| 49 | 73 | |
| 50 | -// Small Caps | |
| 51 | -$this->smCapsScale = 0.75; // Factor of 1 to scale capital letters | |
| 52 | -$this->smCapsStretch = 110; // % to stretch small caps horizontally (i.e. 100 = no stretch) | |
| 53 | - | |
| 54 | - | |
| 55 | -// PAGING | |
| 56 | -$this->mirrorMargins = 0; | |
| 57 | -$this->restoreBlockPagebreaks = false; | |
| 58 | -$this->forcePortraitMargins = false; | |
| 59 | -$this->displayDefaultOrientation = false; | |
| 60 | -$this->printers_info = false; // Adds date and page info for printer when using @page and "marks:crop;" | |
| 61 | -$this->bleedMargin = 5; // mPDF 5.0.047 | |
| 62 | -$this->crossMarkMargin = 5; // Distance of cross mark from margin in mm | |
| 63 | -$this->cropMarkMargin = 8; // Distance of crop mark from margin in mm | |
| 64 | -$this->cropMarkLength = 18; // Default length in mm of crop line | |
| 65 | -$this->nonPrintMargin = 8; // Non-printable border at edge of paper sheet in mm | |
| 66 | - | |
| 67 | - | |
| 68 | -// PAGE NUMBERING | |
| 69 | -// Page numbering - Conditional Text | |
| 70 | -$this->pagenumPrefix; | |
| 71 | -$this->pagenumSuffix; | |
| 72 | -$this->nbpgPrefix; | |
| 73 | -$this->nbpgSuffix; | |
| 74 | - | |
| 75 | - | |
| 76 | -// FONTS LANGUAGES & CHARACTER SETS | |
| 77 | 74 | // Allows automatic character set conversion if "charset=xxx" detected in html header (WriteHTML() ) |
| 78 | 75 | $this->allow_charset_conversion = true; |
| 79 | 76 | $this->biDirectional=false; // automatically determine BIDI text in LTR page |
| 80 | 77 | $this->autoFontGroupSize = 2; // 1: individual words are spanned; 2: words+; 3: as big chunks as possible. |
| @@ -99,14 +96,24 @@ | ||
| 99 | 96 | |
| 100 | 97 | // Automatically correct for tags where HTML specifies optional end tags e.g. P,LI,DD,TD |
| 101 | 98 | // If you are confident input html is valid XHTML, turning this off may make it more reliable(?) |
| 102 | 99 | $this->allow_html_optional_endtags = true; |
| 100 | + | |
| 103 | 101 | $this->ignore_invalid_utf8 = false; |
| 104 | 102 | $this->text_input_as_HTML = false; // Converts all entities in Text inputs to UTF-8 before encoding |
| 105 | 103 | $this->useGraphs = false; |
| 106 | 104 | |
| 107 | 105 | |
| 106 | +// When writing a block element with position:fixed and overflow:auto, mPDF scales it down to fit in the space | |
| 107 | +// by repeatedly rewriting it and making adjustments. These values give the adjustments used, depending how far out | |
| 108 | +// the previous guess was. The lower the number, the quicker it will finish, but the less accurate the fit may be. | |
| 109 | +// FPR1 is for coarse adjustments, and FPR4 for fine adjustments when it is getting closer. | |
| 110 | +$this->incrementFPR1 = 10; // i.e. will alter by 1/[10]th of width and try again until within closer limits | |
| 111 | +$this->incrementFPR2 = 20; | |
| 112 | +$this->incrementFPR3 = 30; | |
| 113 | +$this->incrementFPR4 = 50; // i.e. will alter by 1/[50]th of width and try again when it nearly fits | |
| 108 | 114 | |
| 115 | + | |
| 109 | 116 | // COLORSPACE |
| 110 | 117 | // 1 - allow GRAYSCALE only [convert CMYK/RGB->gray] |
| 111 | 118 | // 2 - allow RGB / SPOT COLOR / Grayscale [convert CMYK->RGB] |
| 112 | 119 | // 3 - allow CMYK / SPOT COLOR / Grayscale [convert RGB->CMYK] |
| @@ -122,24 +129,14 @@ | ||
| 122 | 129 | $this->PDFA = false; // true=Forces compliance with PDFA-1b spec |
| 123 | 130 | // Can use with $this->restrictColorSpace=3 (for a CMYK file) |
| 124 | 131 | // Any other settings, uses RGB profile |
| 125 | 132 | $this->PDFAauto = false; // Overrides warnings making changes when possible to force PDFA1-b compliance |
| 126 | - | |
| 127 | 133 | $this->ICCProfile = ''; // Colour profile OutputIntent |
| 128 | 134 | // sRGB_IEC61966-2-1 (=default if blank and PDFA), or other added .icc profile |
| 129 | 135 | // Must be CMYK for PDFX, or appropriate type for PDFA(RGB or CMYK) |
| 130 | 136 | |
| 131 | 137 | |
| 132 | -// When writing a block element with position:fixed and overflow:auto, mPDF scales it down to fit in the space | |
| 133 | -// by repeatedly rewriting it and making adjustments. These values give the adjustments used, depending how far out | |
| 134 | -// the previous guess was. The lower the number, the quicker it will finish, but the less accurate the fit may be. | |
| 135 | -// FPR1 is for coarse adjustments, and FPR4 for fine adjustments when it is getting closer. | |
| 136 | -$this->incrementFPR1 = 10; // i.e. will alter by 1/[10]th of width and try again until within closer limits | |
| 137 | -$this->incrementFPR2 = 20; | |
| 138 | -$this->incrementFPR3 = 30; | |
| 139 | -$this->incrementFPR4 = 50; // i.e. will alter by 1/[50]th of width and try again when it nearly fits | |
| 140 | 138 | |
| 141 | - | |
| 142 | 139 | // DEBUGGING & DEVELOPERS |
| 143 | 140 | $this->showStats = false; |
| 144 | 141 | $this->debug = false; |
| 145 | 142 | $this->debugfonts = false; // Checks and reports on errors when parsing TTF files - adds significantly to processing time |
| @@ -155,9 +152,21 @@ | ||
| 155 | 152 | $this->annotOpacity = 0.5; // default opacity for Annotations |
| 156 | 153 | |
| 157 | 154 | // BOOKMARKS |
| 158 | 155 | $this->anchor2Bookmark = 0; // makes <a name=""> into a bookmark as well as internal link target; 1 = just name; 2 = name (p.34) |
| 156 | +// Set an optional array to specify appearance of Bookmarks (by level) | |
| 157 | +// Default values are Black and normal style | |
| 158 | +/* | |
| 159 | + Example: | |
| 160 | +$this->bookmarkStyles = array( | |
| 161 | + 0 => array('color'=> array(0,64,128), 'style'=>'B'), | |
| 162 | + 1 => array('color'=> array(128,0,0), 'style'=>''), | |
| 163 | + 2 => array('color'=> array(0,128,0), 'style'=>'I'), | |
| 164 | +); | |
| 165 | +*/ | |
| 166 | +$this->bookmarkStyles = array(); | |
| 159 | 167 | |
| 168 | + | |
| 160 | 169 | // CSS & STYLES |
| 161 | 170 | $this->CSSselectMedia='print'; // screen, print, or any other CSS @media type (not "all") |
| 162 | 171 | |
| 163 | 172 | |
| @@ -182,8 +191,12 @@ | ||
| 182 | 191 | |
| 183 | 192 | // TABLES |
| 184 | 193 | $this->simpleTables = false; // Forces all cells to have same border, background etc. Improves performance |
| 185 | 194 | $this->packTableData = false; // Reduce memory usage processing tables (but with increased processing time) |
| 195 | +// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased | |
| 196 | +// executon time and disk access (read and write) | |
| 197 | +$this->cacheTables = false; | |
| 198 | + | |
| 186 | 199 | $this->ignore_table_percents = false; |
| 187 | 200 | $this->ignore_table_widths = false; |
| 188 | 201 | $this->keep_table_proportions = false; // If table width set > page width, force resizing but keep relative sizes |
| 189 | 202 | // Also forces respect of cell widths set by % |
| @@ -193,11 +206,14 @@ | ||
| 193 | 206 | $this->tableMinSizePriority = false; // If page-break-inside:avoid but cannot fit on full page without |
| 194 | 207 | // exceeding autosize; setting this value to true will force respsect for |
| 195 | 208 | // autosize, and disable the page-break-inside:avoid |
| 196 | 209 | |
| 197 | -$this->use_kwt = false; | |
| 210 | +$this->use_kwt = false; // "Keep-with-table" | |
| 198 | 211 | $this->iterationCounter = false; // Set to TRUE to use table Head iteration counter |
| 212 | +$this->splitTableBorderWidth = 0; // Use table border (using this width in mm) when table breaks across pages | |
| 213 | + // Recommended to use small value e.g. 0.01 | |
| 199 | 214 | |
| 215 | + | |
| 200 | 216 | // IMAGES |
| 201 | 217 | $this->img_dpi = 96; // Default dpi to output images if size not defined |
| 202 | 218 | // See also above "dpi" |
| 203 | 219 | |
| @@ -212,20 +228,20 @@ | ||
| 212 | 228 | $this->jSmaxChar = 2; // Maximum spacing to allocate to character spacing. (0 = no maximum) |
| 213 | 229 | |
| 214 | 230 | $this->jSmaxCharLast = 1; // Maximum character spacing allowed (carried over) when finishing a last line |
| 215 | 231 | $this->jSmaxWordLast = 2; // Maximum word spacing allowed (carried over) when finishing a last line |
| 216 | -$this->orphansAllowed = 5; // No of SUP or SUB characters to include on line to avoid leaving e.g. end of line//<sup>32</sup> | |
| 217 | 232 | $this->normalLineheight = 1.33; // Value used for line-height when CSS specified as 'normal' (default) |
| 218 | 233 | |
| 234 | +// Small Caps | |
| 235 | +$this->smCapsScale = 0.75; // Factor of 1 to scale capital letters | |
| 236 | +$this->smCapsStretch = 110; // % to stretch small caps horizontally (i.e. 100 = no stretch) | |
| 219 | 237 | |
| 220 | 238 | // CJK Line-breaking |
| 221 | 239 | $this->allowCJKorphans = true; // FALSE=always wrap to next line; TRUE=squeeze or overflow |
| 222 | 240 | $this->allowCJKoverflow = false; // FALSE=squeeze; TRUE=overflow (only some characters, and disabled in tables) |
| 241 | +$this->CJKforceend = false; // Forces overflowng punctuation to hang outside right margin mPDF 5.6.40 | |
| 223 | 242 | |
| 224 | - | |
| 225 | 243 | // HYPHENATION |
| 226 | -$this->hyphenate = false; | |
| 227 | -$this->hyphenateTables = false; | |
| 228 | 244 | $this->SHYlang = "en"; // Should be one of: 'en','de','es','fi','fr','it','nl','pl','ru','sv' |
| 229 | 245 | $this->SHYleftmin = 2; |
| 230 | 246 | $this->SHYrightmin = 2; |
| 231 | 247 | $this->SHYcharmin = 2; |
| @@ -241,8 +257,10 @@ | ||
| 241 | 257 | $this->list_align_style = 'R'; // Determines alignment of numbers in numbered lists |
| 242 | 258 | $this->list_indent_first_level = 0; // 1/0 yex/no to indent first level of list |
| 243 | 259 | $this->list_number_suffix = '.'; // Content to follow a numbered list marker e.g. '.' gives 1. or IV.; ')' gives 1) or a) |
| 244 | 260 | |
| 261 | +// ACTIVE FORMS | |
| 262 | +$this->useActiveForms = false; | |
| 245 | 263 | |
| 246 | 264 | // WATERMARKS |
| 247 | 265 | $this->watermarkImgBehind = false; |
| 248 | 266 | $this->showWatermarkText = 0; |
| @@ -270,8 +288,9 @@ | ||
| 270 | 288 | 'FONT-SIZE' => '11pt', |
| 271 | 289 | 'TEXT-INDENT' => '0pt', |
| 272 | 290 | 'LINE-HEIGHT' => 'normal', |
| 273 | 291 | 'MARGIN-COLLAPSE' => 'collapse', /* Custom property to collapse top/bottom margins at top/bottom of page - ignored in tables/lists */ |
| 292 | + 'HYPHENS' => 'manual', /* mPDF 5.6.08 */ | |
| 274 | 293 | ), |
| 275 | 294 | 'P' => array( |
| 276 | 295 | 'MARGIN' => '1.12em 0', |
| 277 | 296 | ), |
| @@ -443,9 +462,9 @@ | ||
| 443 | 462 | 'PADDING-TOP' => '0.1em', |
| 444 | 463 | 'PADDING-BOTTOM' => '0.1em', |
| 445 | 464 | ), |
| 446 | 465 | 'CAPTION' => array( |
| 447 | - 'TEXT-ALIGN' => 'center', /* Added mPDF 5.4 */ | |
| 466 | + 'TEXT-ALIGN' => 'center', | |
| 448 | 467 | ), |
| 449 | 468 | 'IMG' => array( |
| 450 | 469 | 'MARGIN' => '0', |
| 451 | 470 | 'VERTICAL-ALIGN' => 'baseline', |
| @@ -464,8 +483,11 @@ | ||
| 464 | 483 | 'FONT-FAMILY' => 'monospace', |
| 465 | 484 | 'FONT-SIZE' => '0.9em', |
| 466 | 485 | 'VERTICAL-ALIGN' => 'text-bottom', |
| 467 | 486 | ), |
| 487 | + 'MARK' => array( /* mPDF 5.5.09 */ | |
| 488 | + 'BACKGROUND-COLOR' => 'yellow', | |
| 489 | + ), | |
| 468 | 490 | ); |
| 469 | 491 | |
| 470 | 492 | |
| 471 | 493 | ////////////////////////////////////////////////// |
| @@ -483,9 +505,8 @@ | ||
| 483 | 505 | |
| 484 | 506 | // CHARACTER PATTERN MATCHES TO DETECT LANGUAGES |
| 485 | 507 | // pattern used to detect RTL characters -> force RTL |
| 486 | 508 | $this->pregRTLchars = "\x{0590}-\x{06FF}\x{0700}-\x{083E}\x{FB00}-\x{FDFD}\x{FE70}-\x{FEFF}"; |
| 487 | - // mPDF 5 Now includes Syriac, Thaana, N'Ko and Samaritan | |
| 488 | 509 | |
| 489 | 510 | // CJK Chars which require changing and are distinctive of specific charset |
| 490 | 511 | $this->pregUHCchars = "\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}"; |
| 491 | 512 | $this->pregSJISchars = "\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3190}-\x{319F}\x{31F0}-\x{31FF}"; |
| @@ -537,12 +558,15 @@ | ||
| 537 | 558 | $this->pregINDextra = "\x{200B}-\x{200D}\x{0964}\x{0965}\x{0020}-\x{0022}\x{0024}-\x{002E}\x{003A}-\x{003F}\x{005B}-\x{0060}\x{007B}-\x{007E}\x{00A0}"; |
| 538 | 559 | // 200B-D=Zero-width joiners; 0964,0965=Generic Indic punctuation; NBSP & general punctuation (excludes # and / so can use in autoFont() ) |
| 539 | 560 | |
| 540 | 561 | $this->allowedCSStags = 'DIV|P|H1|H2|H3|H4|H5|H6|FORM|IMG|A|BODY|TABLE|HR|THEAD|TFOOT|TBODY|TH|TR|TD|UL|OL|LI|PRE|BLOCKQUOTE|ADDRESS|DL|DT|DD'; |
| 562 | +$this->allowedCSStags .= '|ARTICLE|ASIDE|FIGURE|FIGCAPTION|FOOTER|HEADER|HGROUP|NAV|SECTION|MARK|DETAILS|SUMMARY|METER|PROGRESS|TIME'; // mPDF 5.5.09 | |
| 541 | 563 | $this->allowedCSStags .= '|SPAN|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|STRIKE|S|U|DEL|INS|Q|FONT'; |
| 542 | -$this->allowedCSStags .= '|SELECT|INPUT|TEXTAREA|CAPTION'; // mPDF 5.4 | |
| 564 | +$this->allowedCSStags .= '|SELECT|INPUT|TEXTAREA|CAPTION|FIELDSET|LEGEND'; // mPDF 5.4.18 | |
| 565 | +$this->allowedCSStags .= '|TEXTCIRCLE|DOTTAB'; // mPDF 5.5.23 // mPDF 5.6.33 | |
| 543 | 566 | |
| 544 | -$this->outerblocktags = array('DIV','FORM','CENTER','DL'); | |
| 545 | -$this->innerblocktags = array('P','BLOCKQUOTE','ADDRESS','PRE','H1','H2','H3','H4','H5','H6','DT','DD','CAPTION'); // mPDF 5.4 | |
| 567 | +$this->outerblocktags = array('DIV','FORM','CENTER','DL','FIELDSET','ARTICLE','ASIDE','FIGURE','FIGCAPTION', 'FOOTER','HEADER','HGROUP','NAV','SECTION','DETAILS','SUMMARY'); // mPDF 5.5.09 // mPDF 5.5.22 | |
| 568 | +$this->innerblocktags = array('P','BLOCKQUOTE','ADDRESS','PRE','H1','H2','H3','H4','H5','H6','DT','DD','CAPTION'); | |
| 569 | + | |
| 546 | 570 | |
| 547 | 571 | |
| 548 | 572 | ?> |