DOMPDF fonts not rendering correctly when transferred from localhost to live

Fonts in DOMPDF are working alright doesn’t matter if its a custom font or default font when you are developing in localhost, but when you had transferred it to your live hosting, the font behavior that is rendering is not quite the same (font-size, font-weight, etc.)

Solution 1: Delete the lib/fonts/dompdf_font_family_cache.php in your DOMPDF installation. This will regenerate the cache file and restore the font settings you had installed in the DOMPDF directory.

Please backup the fonts/ directory before doing this so you can restore the folder if this does not work.

Solution 2: Find all “\” in your lib/fonts/dompdf_font_family_cache.php file and replace it with “/”. If you are working in Windows in your localhost then your live server is Linux then this might be the solution for you.