Search code examples
pdflaravel-8mpdf

Laravel MPDF Temporary files directory "C:\inetpub\wwwroot\laravel/../temp/" is not writable


i have the same problem, i've tried to change permission on the Security section of the main and sub folders. i changed temp_dir => to many locations as storage_path('/temp') // public_path('temp') // base_path('temp')

but notthing new , always getting same error.

Temporary files directory "C:\inetpub\wwwroot\laravel\../temp//mpdf" is not writable

i deployed my project laravel on windows server


Solution

  • I found a solution.

    i added tempdir path as parameter in loadview function

    $pdf = PDF::loadView('pdf', $data, [], ['tempDir' => storage_path('tempdir') ])->save($pdfFilePath);

    $pdf->stream('nicesnippets.pdf');