Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

diazfarindra's avatar

Laravel DomPDF Permission denied, The communication protocol is not supported

so I got this error:

Permission denied on /home/inditech/projects/laravel/e-ticketing/public/temp_html/test.html. The communication protocol is not supported.

and this is my simple code:

class TestController extends Controller
{
    public function __invoke()
    {
        return Pdf::loadFile(public_path('temp_html/test.html'))
            ->save(public_path('temp/test.pdf'));
    }
}

I'm testing the controller with a simple Http GET route, what could I get wrong here?

i cant find any answer on the internet. thanks in advance

1 like
1 reply
Talinon's avatar

@diazfarindra It's likely because loadFile() doesn't support html files.

Something like this will likely get your desired result:

   public function __invoke()
    {

       $html = file_get_contents(public_path('temp_html/test.html'));
		
        return Pdf::loadHtml($html)
            ->save(public_path('temp/test.pdf'));
    }

Please or to participate in this conversation.