anbesivam
anbesivam

Reputation: 27

how to set page orientation in html to pdf using mpdf?

i want to download html as pdf in landscape mode

 $mpdf = new mPDF('c', 'A4-L','0', '0', '15', '15','15', '15'); 

but it will not fit into the page. it shows shring the page. why?

Upvotes: 0

Views: 2469

Answers (1)

Sanu0786
Sanu0786

Reputation: 569

In mPDF version 7.0.0 or later the configuration need to be parsed as array[]:

$myMpdf = new Mpdf([
    'mode' => 'utf-8',
    'format' => 'A4-L',
    'orientation' => 'L'
]

In older version before version 7.0.0. it need to be done like this:

myMpdf = new mPDF(
    '',    // mode - default ''
    'A4-L',    // format - A4, for example, default ''
    0,     // font size - default 0
    '',    // default font family
    15,    // margin_left
    15,    // margin right
    16,    // margin top
    16,    // margin bottom
    9,     // margin header
    9,     // margin footer
    'L'    // L - landscape, P - portrait
);

Upvotes: 1

Related Questions