How can I customize font and page in laravel dompdf? How can I customize font and page in laravel dompdf? laravel laravel

How can I customize font and page in laravel dompdf?


try in laravel 5.5 above.

1.first download the font which u want to add(or set) as .ttf extenstion

2.store inside laravel storage folder like this storage/fonts/yourfont.ttf

3.Use CSS @font-face rules inside your blade..

4.for example create sample.blade.php file like this

<html><head>    <meta http-equiv="Content-Type" content="charset=utf-8" />    <style type="text/css">        @font-face {            font-family: 'yourfont'; //you can set your custom name also here..            src: url({{ storage_path('fonts/yourfont.ttf') }}) format('truetype');            font-weight: 400; // use the matching font-weight here ( 100, 200, 300, 400, etc).            font-style: normal; // use the matching font-style here         }                body{            font-family: "yourfont",  //set your font name u can set custom font name also which u set in @font-face css rule    </style></head><body>    Check your font is working or not...</body></html>