.gradient { border:0.1mm solid #220044; background-color: #f0f2ff; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; box-shadow: 0.3em 0.3em #888888; } .rounded { border:0.1mm solid #220044; background-color: #f0f2ff; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; border-radius: 2mm; background-clip: border-box; } h4 { font-weight: bold; margin-top: 1em; margin-bottom: 0.3em; margin-top: 0; } div.text { padding:0.8em; margin-bottom: 0.7em; } p { margin: 0.25em 0; } .code { font-family: monospace; font-size: 9pt; background-color: #d5d5d5; margin: 1em 1cm; padding: 0 0.3cm; border:0.2mm solid #000088; box-shadow: 0.3em 0.3em #888888; } table { overflow: visible; empty-cells: hide; border:1px solid #000000; font-family: sans-serif; font-size: 10pt; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; } td, th { border:1px solid #000000; text-align: left; font-weight: normal; } td.markedcell { text-decoration: line-through; color: #CC0000; } td.underlinedcell { text-decoration: underline; color: #CC0000; } td.rotatedcell { text-decoration: line-through; color: #CC0000; text-rotate: 45; } td.cost { text-align: right; } caption.tablecaption { font-family: sans-serif; font-weight: bold; border: none; caption-side: top; margin-bottom: 0; text-align: center; } u.doubleu { text-decoration: none; border-bottom: 3px double #000088; } a.reddashed { text-decoration: none; border: 1px dashed #880000; } .shadowtitle { height: 8mm; background-color: #EEDDFF; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; padding: 0.8em; padding-left: 3em; font-family:sans; font-size: 26pt; font-weight: bold; border: 0.2mm solid white; border-radius: 0.2em; box-shadow: 0 0 2em 0.5em rgba(0,0,255,0.9); color: #AAAACC; text-shadow: 0.03em 0.03em #666, 0.05em 0.05em rgba(127,127,127,0.5), -0.015em -0.015em white; } h3 { margin: 3em 0 2em -15mm; background-color: #EEDDFF; background-gradient: linear #c7cdde #f0f2ff 0 1 0 0.5; padding: 0.5em; padding-left: 3em; width: 50%; font-family:sans; font-size: 16pt; font-weight: bold; border-left: none; border-radius: 0 2em 2em 0; box-shadow: 0 0 2em 0.5em rgba(255,0,0,1); text-shadow: 0.05em 0.04em rgba(127,127,127,0.5); } .css { font-family: arial; font-style: italic; color: #000088; } table.zebra tbody tr:nth-child(2n+1) td { background-color: rgba(255,255,127,0.6); } table.zebra tbody tr:nth-child(2n+1) th { background-color: rgba(255,255,127,0.6); } table.zebra thead tr { background-color: #FFBBFF; } table.zebra tfoot tr { background-color: #BBFFFF; }
Bookmarks can be styled by adding code as below to your script. You can define a colour (array of RGB) and/or a font-style (B, I, or BI) for each level (starting at 0). Results may depend on the PDF Reader you are using.
$this->bookmarkStyles = array(
0 => array(\'color\'=> array(0,64,128), \'style\'=>\'B\'),
1 => array(\'color\'=> array(128,0,0), \'style\'=>\'\'),
2 => array(\'color\'=> array(0,128,0), \'style\'=>\'I\'),
);
SVG Images can be embedded in your HTML code. This is formally part of the XHTML specification and is supported by IE9+ and most other browsers.
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 200 200" width="200" height="200">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="1" fill="red" />
<circle cx="130" cy="50" r="40" stroke="black" stroke-width="1" fill="blue" />
</svg>
border-radius is now supported on fixed/absolute-positioned block elements.
visibility can be set on any block-style element e.g. DIV,P or images IMG as: visible|hidden|printonly|screenonly
background-color now supports rgba() and cmyka() alpha transparency formats in tables.
Color, underline and strike-through are now supported in table cells, including with rotated text (see example below of spread table)
page-break-after: left|right|always is supported on all block-style elements and tables
text-transform: capitalize|uppercase|lowercase is supported in table cells
:nth-child() selector can be used in tables (on TR, TD or TH) to stripe rows or columns. Both the an+b and odd/even forms are supported e.g.
tr:nth-child(2n+1) { background-color: rgba(255,255,127,0.6); } or
tr:nth-child(odd) { background-color: rgba(255,255,127,0.6); }
Row 1 | This is data | 167.00 |
---|---|---|
Row 2 |
This is data p |
444.53 |
Row 3 |
This is long data |
14.00 |
Row 4 |
This is data |
0.88 |
Row 5 | Also data | 144.00 |
Row 6 | Also data | 8089.00 |
Note: mPDF does NOT correctly apply specificity to all CSS. The following stylesheet:
table.zebra tbody tr:nth-child(2n+1) td { background-color: yellow; }
table.zebra tbody td:nth-child(odd) { background-color: blue; }
should make every odd row yellow, and every odd column blue, but with the row/yellow overriding the column/blue. In mPDF the td:nth-child(odd) trumps the plain td, so the column colour wins out. You can force the effect you want by using:
table.zebra tbody tr:nth-child(2n+1) td:nth-child(1n+0) { background-color: yellow; }
The :nth-child(1n+0) selector just selects every td cell.
border can now be defined on in-line elements eg SPAN
Note: Remember that in mPDF, inside table cells, properties set on block elements are set when possible as in-line properties - so a P element inside a table with border set, will appear with a border around the text line as though it had been set on SPAN
box-shadow can be defined on any block-level element (P, DIV etc). It follows the CSS3 recommendation, but inset is not supported.
text-shadow can be defined on any element. It follows the CSS3 recommendation, but blur is not supported.
<span style="text-shadow: 0.03em 0.03em #666, -0.015em -0.015em white;">
<div style="box-shadow: 0.3em 0.3em #888888;">
{colsum} placed in the footer of a table will automatically display the sum of that column. If the table breaks across more than one page, the sum of the values on that page will be displayed. A number following the colsum e.g. {colsum2} will force that number of decimal places to be displayed.
Header Row | Header Row | Header Row |
---|---|---|
Column total: (using colsum2 in {}) | {colsum2} | |
Row 1 | This is data | 167.00 |
Row 2 |
This is data p |
444.53 |
Row 3 |
This is long data |
14.00 |
Row 4 |
This is data |
0.88 |
Row 5 | Also data | 144.00 |
Row 6 | Also data | 8089.00 |
Row 7 | Also data | 3.00 |
Row 8 | Also data | 23.00 |
The caption element for tables is partially supported (see example above).
<caption align="top|bottom" style="caption-side: top|bottom">
Core fonts, which do not need to be embedded in a PDF, can now be included in a document which uses non-core fonts. The pseudo font-family names: chelvetica, ctimes and ccourier should be used.
<div style="font-family: chelvetica">
NB You could force mPDF to always use core fonts when Arial/Helvetica/Courier are specified, by editing $this->fonttrans in config_fonts.php:
$this->fonttrans = array(
\'arial\' => \'chelvetica\',
\'helvetica\' => \'chelvetica\',
\'timesnewroman\' => \'ctimes\',
\'times\' => \'ctimes\',
\'couriernew\' => \'ccourier\',
\'courier\' => \'ccourier\',
...
Javascript used in (active) forms has been altered to reflect the Adobe Acrobat specification for Javascript in PDF documents.
textarea and input (text-types) now accept javascript as: onKeystroke, onValidate, onCalculate and onFormat. onChange is depracated but is not ignored; it works as though for onCalculate. (PS Select still accepts onChange)
Support for overlapping rowspans in tables has been improved (although probably not foolproof!)
Circular Text can be included in a PDF document as a custom HTML tag (or a function)
NB If $mpdf->useKerning is true then automatic kerning will be used on Circular Text.
<textcircle r="30mm" top-text="Circular Text Circular Text" style="color: blue; font-size: 34pt; font-style: italic" />
<textcircle r="30mm" space-width="120" char-width="150" top-text="• Circular Text •" bottom-text="Circular Text" style="background-color: #FFAAAA; border:1px solid red; padding: 0.3em; margin: 0.3em; color: #000000; font-size: 21pt; font-weight:bold; font-family: Arial" />
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
H | He | ||||||||||||||||
Li | Be | B | C | N | O | F | Ne | ||||||||||
Na | Mg | Al | Si | P | S | Cl | Ar | ||||||||||
K | Ca | Sc | Ti | V | Cr | Mn | Fe | Co | Ni | Cu | Zn | Ga | Ge | As | Se | Br | Kr |
Rb | Sr | Y | Zr | Nb | Mo | Tc | Ru | Rh | Pd | Ag | Cd | In | Sn | Sb | Te | I | Xe |
Cs | Ba | Lu | Hf | Ta | W | Re | Os | Ir | Pt | Au | Hg | Tl | Pb | Bi | Po | At | Rn |
Fr | Ra |