Skip to main content
Version: 3

Example of Table Support in PDF Templates

Tables

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-tables04.php Example URL: https://test.com/?gf_pdf=1&fid=3&lid=40&template=example-tables04.php

There is quite good support for tables in mPDF (compared with similar software packages). It even includes advanced features like auto scaling text, nested tables and 90 degree rotation.

Download Example PDF
There is no block-level CSS support inside tables, however the content will be rendered. That means no CSS targeted at block-level elements inside a table will be applied.

Rotating Table

Tables can be rotated 90 degrees so they fit nicely on portrait documents. This feature can be applied using the CSS rotate: 90|-90; property.
table {
rotate: 90;
}

Autosizing

If a table's minimum width is too wide for the outer container it will automatically reduce the font size in order to fit. The minimum width is calculated by the sum of column widths required to fit the longest single word in the column.

If you want to prevent any unnecessary resizing for a particular table you can add the autosize="1" attribute to the table element <table autosize="1">.

Repeating Header and Footers

If a table extends across multiple pages the <thead></thead> and <tfoot></tfoot> elements will be appended and prepended respectfully to each new page the table extends to.

Please read the mPDF documentation for additional details on table configuration.