Laravel HTML to PDF conversion (DOMPDF) Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Laravel HTML to PDF conversion (DOMPDF) without wasting too much if your time.

The question is published on by Tutorial Guruji team.

DOMPDF Wrapper for Laravel 5, It’s a html to pdf converter for laravel 5.

I have tried to convert laravel default auth register page to PDF and the path is Code used for this purpose is given below. But I am getting font issue. Could you please help me to solve this issue?


Route::post('/screenshot', function(){
    $pdf  =  App::make('dompdf.wrapper');
    $view =  View::make('auth.register')->render();
    //return $pdf->stream('invoice');
    return $pdf->download('profile.pdf');


ErrorException in font_metrics.cls.php line 343: file_put_contents(C:xampphtdocscareertagstoragefonts/13350985545a9988387f8a573f409063.ttf): failed to open stream: No such file or directory


Create fonts folder inside storage directory and make sure storage is writable by web server by running follwing command. This worked for me.

sudo chmod -R 777 storage

Above (777) can be dangerous, therefore to achieve it in a secure way, try the below commands.

sudo find storage -type d -exec chmod 755 {} ; 
sudo find storage -type f -exec chmod 644 {} ;
We are here to answer your question about Laravel HTML to PDF conversion (DOMPDF) - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji