I am using barryvdh/laravel-dompdf for quite long. Using external CSS (From local) and font (From CDN), It was working fine and suddenly the design collapsed, also the font not working so I've checked in the view and came to know the view is not loading the CSS & fonts. I am using Laravel 5.5 and barryvdh/laravel-dompdf version is 0.8.6. Tried in Laravel 8 with barryvdh/laravel-dompdf version 0.9.0 also not working.
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Receipt | - </title>
<link href="" rel="stylesheet" type="text/css" media="all" />
<link href="" rel="stylesheet" type="text/css" media="all" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" media="all" />
<style type="text/css">
/* Another font (Chinese) loaded from local folder for particular tags */
@font-face {
font-family: SimHei;
src: url('') format('truetype');
}
body{
font-family: Open Sans, Sans-serif; line-height: 1;
}
p {
font-size: 18px;
margin-bottom: 0 !important;
}
</style>
</head>
For CSS, I have tried to update
<link href="" rel="stylesheet" type="text/css" media="all" />
to
On Local:
<link href="" rel="stylesheet" type="text/css" media="all" />
<link href="" rel="stylesheet" type="text/css" media="all" />
<link href="http://127.0.0.1:8000/css/main.css' }}" rel="stylesheet" type="text/css" media="all" />
On server:
<link href="var/www/html/project/public/css/main.css" rel="stylesheet" type="text/css" media="all" />
For the font, I have tried to have it in a local folder as a .ttf file, and importing in style still doesn't work.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire