My issue
I am trying to create a pdf file using MPDF but after I installed mpdf I get the following error that it uses depricated curly braces.
I am using php 8.0.0 and my mpdf version is 6.1.
What I tried
- change the curly braces to brackets but this broke the library completely saying non number values are encountered.
The errors I am getting after fixing the depricated curly braces are the following:
Warning: A non-numeric value encountered in C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfmpdf.php on line 30572
Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, string given in C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfclassestfontsuni.php:613 Stack trace: #0 C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfclassestfontsuni.php(202): TTFontFile->extractInfo(false, true, 0) #1 C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfmpdf.php(3880): TTFontFile->getMetrics('C:/xampp/htdocs...', 'dejavuserifcond...', 0, false, true, 0) #2 C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfmpdf.php(4246): mPDF->AddFont('dejavuserifcond...', '') #3 C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfmpdf.php(13621): mPDF->SetFont('dejavuserifcond...') #4 C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfmpdf.php(1287): mPDF->SetDefaultFont('serif') #5 C:xampphtdocsackendJaar2Project_webshopLibrarypdf_genereren.php(8): mPDF->__construct() #6 {main} thrown in C:xampphtdocsackendJaar2Project_webshopLibraryvendormpdfmpdfclassestfontsuni.php on line 613
- reinstalled the library twice, reinstalled composer once
- Upgrade to the latest stable php version (8.0.1)
<?php
ob_clean();
ob_start();
$rapport = ob_get_clean();
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new mPDF();
$mpdf->showImageErrors = true;
$mpdf->WriteHTML("<h1>Hello world..</h1>");
$mpdf->Output();
?>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…