Skip to main content
Version: 3

An Example of Images in Custom PDF Templates

Images

The plugin ships with a number of PDF templates showing off the features of mPDF. These can be found in your PDF_EXTENDED_TEMPLATES directory.

Overview

To easily switch between custom PDF templates change the template query string parameter to the template name when viewing a PDF via your admin area.
Template Name: example-images03.phpExample URL: https://test.com/?gf_pdf=1&fid=3&lid=40&template=example-images03.php

The image example displays all supported image formats in mPDF. It also highlights the opacity and rotate CSS properties. Support image formats include GIF, PNG, JPG, WMF, SVG, BMP.

Download Example PDF
Images are hard-coded to be inline elements.
Images can be memory intensive. If you are concerned about performance you should always use the JPG format.

Float Support

There is partial support for floating images in mPDF however the following limitations apply:
  • You can only have one floated image left and one floated right per container.
  • Unlike your browser (which will overflow the image out of the container), the containing HTML element is extended at the bottom if necessary to enclose the floated image.
  • Floats are ignored if the image is too wide for the container, inside a table, or div page-break-inside: avoid is set.
View the mPDF documentation for more information about image support.