mPDF Manual – What Else Can I Do

# Fixed position blocks

mPDF >= 4.0

## Position

The CSS property “position” is partially supported in mPDF, allowing a block element (div etc.) to be placed at a fixed position on the page.

$absolute - treats the whole physical page as the containing element$fixed - treats the ‘printable page’ (inside the margins) as the containing element

$rotate - (introduced mPDF 5.0) rotates the block element 90 degrees clockwise or anticlockwise  top left bottom right width height are all used to set the size of the block element BEFORE rotation i.e. if the width is not specified, the lft and right margins will be used to calculate the width. After rotation, left top are used to position the top left corner of the (rotated) element. There is an exception if bottom or right are specified without the respective top or left values; in this case these values are used to position the bottom or right edge of the (rotated) element. Limitations: • There is no equivalent concept of the viewport as in the browser (in CSS) • All positioning is relative to the current page of the document being written • Position is overridden if it would be off the page, so that the element displays within the containing element • Overflow:auto causes text to autofit within the block size (additionally constrained if necessary to page edges). • Fixed-position or floating elements nested inside other fixed-position or floating elements are not supported • Probably INCOMPATIBLE with keep-with-table, columns etc. • Annotations were disabled prior to mPDF 5.0 ### Overflow The CSS property “overflow” determines how text is displayed if the block element size is too small for the text.$visible - all text will show, even if it lies outside the defined block element

$hidden - text will be ‘clipped’ so that overflowing text is not visible$auto - text will be automatically reduced in size if required to fit inside the block element

Example #1