mPDF Manual – What Else Can I Do

# Replaceable Aliases

There are several placemarkers you can include, which will be replaced when the PDF file is ouput:

${nb​} </span> Will be replaced by the total number of pages in the document. This disregards any changes you make to page numbering with AddPage() or <pagebreak> and will always return the actual number of pages in the PDF document. You can change this alias (in case you wish to use the text “{nb​}” in your document) using AliasNbPages(). The alias is case-sensitive.${nbpg​}

Will be replaced by the total number of pages in the document or page group. If you have reset the page numbering with AddPage() or <pagebreak> the total number of pages in the current page group will be used (up to where the numbering is reset) rather the total number of pages in the whole document. You can change this alias (in case you wish to use the text “{nbpg​}” in your document) using AliasNbPageGroups(). The alias is case-sensitive. The numbering style can be changed using AddPage() or <pagebreak>.

${PAGENO} Will be replaced by the Page number - but only in headers/footers. If you have reset the page numbering with AddPage() or <pagebreak> the calculated document page number will be used rather the physical PDF document page number. You cannot change this alias. The alias is case-sensitive. The numbering style can be changed using AddPage() or <pagebreak>.${DATE d/m/Y}

Will be replaced by today’s date - but only in headers/footers. The alias is case-sensitive. The date format can be defined using any of the values in the PHP function date(). There must be a space after ${DATE Example:${DATE j-m-Y H:m}

${colsum} {colsumN} </span> Place in cell inside a table footer i.e. <tfoot><td>. The total of values in the corresponding column will be output at the bottom of every page, and the end of the tale. Default output is an integer. An optional integer N after colsum will specify a fixed number of decimal places. (mPDF >= 5.4)${iteration varname}

</span>

Place in cell inside table header i.e. <thead><td>. You can use any alphanumeric string as a unique varname. (When processed by mPDF it will be replaced by “_varname” to avoid collision with an mPDF internal variable. The length of the alhanumeric string will determine the length of the placeholder used to space the text i.e. if your counter will reach 1000 you should use a string of at least 4-5 characters in length.