mPDF Manual – mPDF functions

# __construct()

(mPDF ≥ 7.0)

@todo

__construct – Initialise an instance of mPDF class

\Mpdf\Mpdf::__construct([array $config = []]) Initialise an instance of mPDF class. ## Parameters$config

This parameter specifies configuration of the new document.

## Examples

### Example #1

<?php

$mpdf = new \Mpdf\Mpdf();$mpdf->WriteHTML('Hello World');

$mpdf->Output('filename.pdf');  ### Example #2 <?php // Define a new \Mpdf\Mpdf document using utf-8 fonts$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8']);

// Define a new \Mpdf\Mpdf document using win-1252 fonts based on a language/country code
$mpdf = new \Mpdf\Mpdf(['mode' => 'en-GB']); // Define a Landscape page size/format by name$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => 'A4-L']);

// Define a page size/format by array - page will be 190mm wide x 236mm height
$mpdf = new \Mpdf\Mpdf(['mode' => 'utf-8', 'format' => [190, 236]]); // Define a page using all default values except "L" for Landscape orientation$mpdf = new \Mpdf\Mpdf(['orientation' => 'L']);
{"ft_lang_label":"__label__en","ft_lang_prob":0.546551,"math_prob":0.81416893,"size":5144,"snap":"2020-34-2020-40","text_gpt3_token_len":1381,"char_repetition_ratio":0.12178988,"word_repetition_ratio":0.026809651,"special_character_ratio":0.27177295,"punctuation_ratio":0.15184382,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96525943,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-08-05T02:16:24Z\",\"WARC-Record-ID\":\"<urn:uuid:96895a5a-2723-4c01-ac0e-34cefb19512d>\",\"Content-Length\":\"79957\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:53713f64-1b81-4c97-bc26-bb1c067b44a6>\",\"WARC-Concurrent-To\":\"<urn:uuid:f9ab1c64-4417-4147-9bd1-ac2a47410177>\",\"WARC-IP-Address\":\"185.199.110.153\",\"WARC-Target-URI\":\"https://mpdf.github.io/reference/mpdf-functions/construct.html\",\"WARC-Payload-Digest\":\"sha1:QLDVNY4YVFBVARXQEOPJDG3Z2EVIEF4R\",\"WARC-Block-Digest\":\"sha1:OBBQRKOGREW6QL25FUBELYM7HAL735BA\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-34/CC-MAIN-2020-34_segments_1596439735906.77_warc_CC-MAIN-20200805010001-20200805040001-00539.warc.gz\"}"}