Kartik/mpdf will not generate a readable PDF

Hello,

i use the kartik/mpdf extensions to generate PDF Docs. But the generated File can not view in Browsers or Acrobat Reader. What is wrong? Can anyone help me?

$content="<h1>Test</h1>";
$pdf = new Pdf([
    'mode' => 'utf-8', 
    'format' => 'A4', 
    'orientation' => 'P', 
    'filename' => 'test.pdf',
    'destination' => 'F',
    'content' => $content
]);
$pdf->output($pdf->content, $pdf->filename, 'D');

Try the MPDF package directly. It removes one layer in your troubleshooting plus you have a guarantee it is latest version

Thank you very much. I use now

    $pdf = Yii::$app->pdf;
    $pdf->content = $htmlContent;
    return $pdf->render();

This works fine…

Is it from MPDF or Kartik’s package?
How do you configure pdf component?

It’s Kartik’s package. But now i have a solution found that work. Thank you anyway.