mPDF Manual – mPDF Variables

Overview

mPDF Variables by Category

Most defaults of the following variables are set in the default configuration classes.

You can redefine the variables in individual scripts as a configuration variable

Category Variable Default value Scope1 Version Notes
Paging mirrorMargins 0 DOCUMENT 4.0 The alias $useOddEven was used before v4.0
  restoreBlockPagebreaks false   2.3  Removed v6.0
  forcePortraitMargins false DOCUMENT 2.3  
  displayDefaultOrientation false DOCUMENT 2.3  
  autoPageBreak true DOCUMENT 3.1  
  setAutoTopMargin false DOCUMENT 4.0  
  setAutoBottomMargin false DOCUMENT 4.0  
  autoMarginPadding 2 DOCUMENT 4.0  
  margBuffer 2 DOCUMENT 5.5 Allows an (empty) end of block to extend beyond the bottom margin by this amount (mm)
  printers_info false   5.1 Adds date and page info for printer when using @page and marks:crop;
  bleedMargin 5   5.1  
  crossMarkMargin 5   5.1 Distance of cross mark from margin in mm
  cropMarkMargin 8   5.1 Distance of crop mark from margin in mm
  cropMarkLength 18   5.1 Default length in mm of crop line
  nonPrintMargin 8   5.1 Non-printable border at edge of paper sheet in mm
  defaultPagebreakType 'cloneall'   6.0 for forced pagebreaks using <pagebreak />
Page numbering aliasNbPg "{nb}" DOCUMENT   NB The default value will not appear correctly in a PDF version of this page; it is substituted by the number of pages.
  aliasNbPgGp "{nbpg}" DOCUMENT   NB The default value will not appear correctly in a PDF version of this page; it is substituted by the number of pages.
pagenumPrefix "" DOCUMENT 3.0  
  pagenumSuffix "" DOCUMENT 3.0  
  nbpgPrefix "" DOCUMENT 3.0  
  nbpgSuffix "" DOCUMENT 3.0  
  defaultPageNumStyle "1" DOCUMENT 6.0  
Fonts, Languages and Character sets percentSubset 30 DOCUMENT 5.0 Control subsetting behaviour for fonts
  useKerning false DOCUMENT 5.4 Set to true to enable CSS support for font-kerning
  maxTTFFilesize 2000 DOCUMENT 5.0 Control subsetting behaviour for fonts
  allow_charset_conversion true      
  charset_in null      
  biDirectional false      
  use_CJK_only false     Removed mPDF 5.0
  useAdobeCJK true DOCUMENT* 5.0 * You must only change this variable as a constructor parameter Use initial parameter to change at runtime e.g. $mpdf = new \Mpdf\Mpdf(['mode' => '+aCJK']);
  autoFontGroupSize 2   2.3 Removed in v6.0
  useLang true   2.3 Default value false before v4.0 Removed in v6.0
  autoScriptToLang false DOCUMENT 6.0 Replaces SetAutoFont function
  autoLangToFont false DOCUMENT 6.0 Replaces useLang
  baseScript 1 DOCUMENT 6.0  
  autoArabic false DOCUMENT 6.0  
  autoVietnamese false DOCUMENT 6.0  
  disableMultilingualJustify false   2.3  Removed in v6.0
  falseBoldWeight 5   4.2 Weight for bold text when using an artificial (outline) bold
  smCapsScale 0.75   5.0 Factor of 1 to scale capital letters
  smCapsStretch 115   5.0 % to stretch small caps horizontally
  backupSubsFont array( 'dejavusanscondensed' )   5.0 Set as a font configuration variable
  backupSIPFont ''   5.0 Set as a font configuration variable
Configuration useOnlyCoreFonts false DOCUMENT (3.0) Removed mPDF 5.0 - Use $mpdf = new \Mpdf\Mpdf(['mode' => 'c']); The alias $use_embeddedfonts_1252 was used before v4.0
  repackageTTF false DOCUMENT 5.2  
  useSubstitutions false   (4.0) NB Altered behaviour mPDF ≥ 5.0 Default value true before v4.0
  useSubstitutionsMB false   4.2 Removed in mPDF 5.0 Use useSusbstitutions instead. Substitute missing characters in UTF-8(multibyte) documents - from core fonts
  collapseBlockMargins true   4.2 Allows top and bottom margins to collapse between block elements
  dpi 96   4.5 Specifies size conversion for objects with size set by "px"
  enableImports false DOCUMENT* 4.3 Enable Imported PDF files (templates) [was mPDFI()] * You must only change this variable as a constructor parameter Use SetImportUse() to change at runtime.
  allow_output_buffering false DOCUMENT 3.0  
  allow_html_optional_endtags true DOCUMENT    
  ignore_invalid_utf8 false      
  text_input_as_HTML false DOCUMENT    
  progressBar false DOCUMENT* 4.2 Shows progress-bars whilst generating file * You must only change this variable as a constructor parameter key Use StartProgressBarOutput() to set at runtime.
  progbar_heading "mPDF file progress" DOCUMENT 5.0 Customise the use of progress-bars
  progbar_altHTML "" DOCUMENT 5.0 Customise the use of progress-bars
  incrementFPR1 [1-4] 10,20,30,50   4.2  
Debugging debug false DOCUMENT 3.1  
  debugfonts false DOCUMENT 5.0 Show errors and warning notes for fonts
  showImageErrors false DOCUMENT 3.0  
PDF/A1-b, PDF/X-1a Colorspaces PDFA false DOCUMENT 4.3  
  PDFAauto false DOCUMENT 4.3  
  PDFX false DOCUMENT 5.1  
  PDFXauto false DOCUMENT 5.1  
  ICCProfile "" DOCUMENT 4.3  
  restrictColorSpace 0 DOCUMENT 5.1  
Annotations title2annots false DOCUMENT 2.2  
  annotMargin null DOCUMENT 2.2  
  annotOpacity 0.5 DOCUMENT 2.2  
Bookmarks (Outlines) anchor2Bookmark 0 DOCUMENT    
  h2bookmarks array() DOCUMENT 5.7 Automatically generate bookmarks from Heading elements H1-H6
  h2toc array() DOCUMENT 5.7 Automatically generate ToC entries from Heading elements H1-H6
CSS & Styles CSSselectMedia "print" DOCUMENT 4.4  
  disablePrintCSS null DOCUMENT   deprecated from ≥ 4.4
  rtlCSS 2 DOCUMENT    Removed from v 5.1
  useDefaultCSS2   DOCUMENT   deprecated from ≥ 2.2
Page Headers & Footers defaultfooterfontsize 8      
  defaultfooterfontstyle "BI"      
  defaultfooterline 1      
  defaultheaderfontsize 8      
  defaultheaderfontstyle "BI"      
  defaultheaderline 1      
  footer_line_spacing 0.25      
  header_line_spacing 0.25      
  forcePortraitHeaders false DOCUMENT    
  headerPageNoMarker "!|" DOCUMENT   deprecated from ≥ 4.0
Tables simpleTables false DOCUMENT 4.3  
  packTableData false DOCUMENT 4.4  
  cacheTables false DOCUMENT 5.4 Removed v6.0
  tableMinSizePriority false   4.6  
  ignore_table_percents false   2.2  
  ignore_table_widths false   2.2  
  keep_table_proportions false   2.2  
  shrink_tables_to_fit 1.4      
  table_error_report false      
  table_error_report_param ""      
  use_kwt false   2.0  
  iterationCounter false DOCUMENT 5.0 Enables the use of a replaceable iteration counter in table headers or footers
  decimal_align cf. DOCUMENT 5.7 Array of characters enabled to align table columns
Images img_dpi 96      
Text Spacing & Justification normalLineheight 1.33   4.2 Value used for line-height when CSS specified as normal
  useFixedNormalLineHeight false   6.0  
  useFixedTextBaseline false   6.0  
  adjustFontDescLineheight 1.14   6.0  
jSmaxChar 2      
  jSmaxWordLast 2   5.1  
  jSmaxCharLast 1   5.1  
  jSpacing null      deprecated from ≥ 5.1
  jSWord 0.4      
  orphansAllowed 5      Removed mPDF 5.7
  allowCJKorphans true   5.2 Wrapping of CJK text
  allowCJKoverflow false   5.2 Wrapping of CJK text
  CJKforceend false   5.7 Wrapping of CJK text
  tabSpaces 8   2.3  
  justifyB4br false   4.4 Justify the line before a <br> when using text-align: justify
Hyphenation hyphenate false   2.5  Removed mPDF 5.7
  hyphenateTables false   2.5  Removed mPDF 5.7
  SHYlang "en"   2.5  
Columns keepColumns false      
  max_colH_correction 1.15      
Lists list_auto_mode "browser"   6.0
  list_indent_default "40px"   6.0  
  list_indent_default_mpdf "0em"   6.0  
  list_marker_offset "5.5pt"   6.0  
  list_symbol_size "3.6pt"   6.0  
  list_align_style "R"   2.1 Removed mPDF 6.0
  list_indent_first_level 0      
  list_number_suffix "."   2.1  
Watermarks showWatermarkImage null   2.2  
  showWatermarkText null   2.2  
  watermark_font ""      
  watermarkImageAlpha 0.2   2.2 Can be changed by SetWatermarkImage()
  watermarkImgAlphaBlend "Normal"   4.5  
  watermarkImgBehind false   4.4 Place watermark images behind page contents
  watermarkTextAlpha 0.2   2.2  
Borders autoPadding false DOCUMENT 3.0  
Bookmarks bookmarkStyles array() DOCUMENT 5.4 Specify appearance of Bookmarks in PDF reader

Notes:

  1. Variables with scope marked as DOCUMENT should only be set once at the beginning of the document. All others can be changed during the course of creating the document. 

Fork me on GitHub