mPDF Manual – mPDF functions



void AutosizeText( string $text, float $width, string $font, string $style [, float $fontsize ])

Writes a single line of text directly to the PDF document at the current position. Font size will be automatically reduced to fit width (but is not increased).

NB Does not reverse RTL text



UTF-8 encoded text to write. Single line only.


Width of text in millimeters. The font size will be reduced if required to fit this size.


Font family to use


Font style used


  • [blank for normal]
  • 'i' - italic
  • 'b' - bold
  • 'bi' - italic and bold

Maximum font size in points (pt)

Default: 72

Fork me on GitHub