Mpdf Error Writing File to a Directory

Asked

Viewed 162 times

0

I am generating pdf file using the MPDF but I need to write it in a directory so that later via php I can take the file and send by email I am generating the file as follows

$dir = strtolower(__dir__.'/_assets/tmp');      
$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/_assets/tmp']);
$mpdf->setdisplaymode('fullpage'); 
$mpdf->writehtml($html); 
$mpdf->output('teste.pdf',$dir); 

But the following mistake is being made:

[Sun Sep 15 12:15:50.056922 2019] [php7:notice] [pid 26464] [client :1:59214] PHP Fatal error: Uncaught Mpdf Mpdfexception: Incorrect output Destination /VAR/WWW/HTML/SISTEMA/_ASSETS/TMP in /var/www/html/system/_vendor/mpdf/mpdf/src/Mpdf.php:9465\nStack trace:\n#0 /var/www/html/sistema/pdftermo.php(133): Mpdf\Mpdf->Output('teste.pdf', '/VAR/WWW/HTML/S...')\n#1 {main}\n thrown in /var/www/html/sistema/_vendor/mpdf/mpdf/src/Mpdf.php on line 9465

Would anyone know what I’m doing wrong or how to get around the problem?

  • For what you report in error Incorrect output destination /VAR/WWW/HTML/SISTEMA/_ASSETS/TMP it seems that this path does not exist.you already checked if this folder exists and if you have permission to write by php?

  • Yes the folder even exists I checked the read and write permissions of the same and this released completely

  • I even tried to put only in place of the variable dir I put the parameter 'F' and still I can’t perform the process.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.