mPDF Manual – Configuration

Configuration v7.x

(mPDF >= 7.0)

Constructor configuration

Configuration of mPDF is handled via $config array parameter of \Mpdf\Mpdf::__construct() method.

  • All configuration variables can be passed to the parameter.

    Default values and other configurable keys are specified in ConfigVariables (source) and FontVariables (source) classes.

  • Also see variables ported from mPDF < 7.0 constructor (see for details: __construct() method)

<?php
// Require composer autoload
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf([
        'mode' => 'utf-8', 
        'format' => [190, 236], 
        'orientation' => 'L'
]);

Runtime configuration

All variables can be changed at runtime using Mpdf public properties as defined in ConfigVariables (source) and FontVariables (source) classes:

Example

<?php

$mpdf->pdf_version = '1.5';

Fork me on GitHub