mPDF Manual – What Else Can I Do

# Text Justification

## Justifying text & Spacing

### Character and Word spacing

When text-alignment is set to justify (i.e. aligning to both right and left margins), word spacing and character spacing are normally used to justify text.

The default is to use a mix of character and word spacing. The ratio is set by \Mpdf\Mpdf properties

<?php

$this->jSWord = 0.4; // Percentage(/100) of spacing to allocate to Word vs. Character$this->jSmaxChar = 2; // Maximum spacing to allocate to character spacing. (0 = no maximum)



### Justification before line-breaks

In a justified text block, an inline <img>, <textarea>, <input> or <select> element which causes a new line, force the previous line to be justified. However, a <hr> or <br> do not force justification of the preceding text.

This behaviour matches most browsers. To allow optional compliance with the behaviour of MS Word, which also justifies text before a <br> you can set the configuration variable justifyB4br to true.