mPDF Manual – mPDF functions

WriteFixedPosHTML()

(mPDF ≥ 4.0)

WriteFixedPosHTML — Write HTML to a fixed position on the current page

Description

void WriteFixedPosHTML ( string $html , float $x , float $y , float $w , float $h [, string $overflow ])

Write HTML to a fixed position on the current page.

Parameters

$html

This parameter specifies the text to write to the document - parsed as HTML code

$x

Sets the $x position of the (left edge) of the block element, set in mm from the left of the page.

$y

Sets the $y position of the (top edge) of the block element, set in mm from the top of the page.

$w

Sets the width of the block element, in mm.

$h

Sets the height of the block element, in mm.

$overflow

Specifies how to handle text which would not fit inside the block element, with its dimensions as specified.

Values

  • 'visible': show all text, even if it spills over outside the dimensions of the block element
  • 'hidden': hide any text (clip) which spills over outside the dimensions of the block element
  • 'auto': force text to be reduced in size if required to fit inside the dimensions of the block element

BLANK uses the default value of 'visible'

Changelog

Version Description
4.0 Function was added.

Examples

Example #1

<?php
$mpdf = new \Mpdf\Mpdf();

$mpdf->WriteHTML('
Beginning bit of document...
');

$mpdf->WriteFixedPosHTML('
This text will appear just where I want it!
', 30, 120, 50, 90, 'auto');

$mpdf->Output();

See Also

Fork me on GitHub