0

I am using mPDF and it is not generating pdf on localhost.

<?php
    include("mpdf/mpdf.php");
    $html='<html>
    <body>
        <div class="container bor" style="">
        <p>Hello World</p>
            </div>
            </body>
        </html>';

    $mpdf=new mPDF('', 'A4', 0, '', 2, 2,5, 0, 0, 0);
    header("Content-type:application/pdf");
    $mpdf->SetDisplayMode('fullpage');
    $invoiceno='demo';
    $mpdf->WriteHTML($html);
    $mpdf->Output($invoiceno.'.PDF','I');
    exit;
    ?>

I have the following error: Fatal error: Switch statements may only contain one default clause in /opt/lampp/htdocs/2018/kunal/mpdf/mpdf.php on line 1422

please help me out.

Kunal Waghmare
  • 183
  • 3
  • 10

2 Answers2

1

I had the same issue moving a site from PHP 5.6 to 7 and found a working solution at https://github.com/kbs1/mpdf-5.7-php7 , very easy to ugrade too, just replace the files.

user1620090
  • 499
  • 6
  • 19
0

Fatal error: Switch statements may only contain one default clause in

It may comes when you will switch the php version or may be you are using mpdf extension for different version

I was implemented the pdf code in php5.6 and now move to php 7 , i got the above error

and the solution is - download latest extension files for php 7 and replace all https://github.com/kbs1/mpdf-5.7-php7