mPDF Manual – What Else Can I Do

Line breaking

The algorithm for determining automatic line breaks was completely rewritten in mPDF v6.0 - the following notes apply to mPDF >= 6.0

Line breaks will be allowed at:

  • Spaces U+0020
  • Word break U+200B
  • Hyphen-minus U+002D when CSS hyphens set to "manual" or "auto", except when in a URL, or when following character is a > or a numeral
  • Hard hyphen U+2010 when CSS hyphens set to "manual" or "auto"
  • Soft hyphen U+00AD "­" when CSS hyphens set to "manual" or "auto"
  • Automatic hyphenation when CSS hyphens set to "auto"
  • Between CJK characters, except CJK numerals, before "CJK-following" or after "CJK-leading" characters

Lao, Thai and Khmer text does not have space between words. By default, mPDF uses word dictionaries to determine appropriate opportunites for line-breaks. Users may turn this function off using the configurable variable useDictionaryLBR.

Alternatively users can insert the character U+200B (zero-width space) in the text to mark line-breaking opportunities manually.

Similarly for Tibetan script, mPDF 6 uses a simple algorithm to identify line-breaking opportunities after the characters U+0F0B (Tsheg) or U+0F0D. This can be overriden using the configurable variable useTibetanLBR.