Closed avptechnocrats closed 4 years ago
Add the following line to the head
part of your blade file to include the external CSS.
<link rel="stylesheet" href="{{ asset('/path/to/your/pdf.css') }}" media="all" />
This is not working for me. No CSS styles are being loaded
Same here :(
I solve this problem by using external CSS's full path. This one worked on my linux ubuntu server :
<link rel="stylesheet" href="/var/www/mysite/public/css/main.css" media="all" />
You also can solve not loaded image problem by using this solution.
Are you using actual servers? Or CLI or something? I think absolute urls should work for apache/nginx
I am using actual production server (Ubuntu 12.04) and it works.
Here take a look about this topic on http://stackoverflow.com/questions/25558449/dompdf-image-not-readable-or-empty
I have tried the below code $pdf = app()->make('dompdf.wrapper'); $pdf->loadHTML('
I solve this problem by using external CSS's full path. This one worked on my linux ubuntu server :
<link href="{{ public_path('css/bootstrap.min.css') }}" rel="stylesheet" type="text/css" />
and work on image.
any solution for windows user ??
its not woking - loading and loading
I am using external css with full url paths , but i am getting an error , while generating pdf i think it is not able to parse / read css classes or selectors.. here's the error i am getting :
@himalayaahuja You're just missing the /fonts
directory that you need to create in your storage
directory
Will there be a way to load this in via Laravel helper functions any time soon? Working with fixed URLs is highly unreliable...
It works for me on Windows :
<link rel="stylesheet" href="{{ ltrim(public_path('css/pdf.css'), '/') }}" />
fix permission +750 all folder css, work fine:
<link rel="stylesheet" href="{{ URL::asset('css/site.css') }}" type="text/css" />
<link rel="stylesheet" href="{{ URL::asset('bootstrap/css/bootstrap.min.css') }}" type="text/css" />
It works for me on Windows :
<link rel="stylesheet" href="{{ ltrim(public_path('css/pdf.css'), '/') }}" />
Im using windows and it works. Thanks!
I was in hurry so i used Occam's razor. I created another blade template, pdf-css, with only one tag:
and in my tempates i added
@include('pdf-css')
It's prolly not the best solution but it is a solution that works without hussle
dompdf have some probles with some styles, for example display:flex. I have to creete a view.blade.php :
{{$sellerorder->id}}
</table>
and add some styles: .left {
text-align: left;
margin: 30px;
}
.rigtht {
text-align: right;
margin: 30px;
}
.center {
text-align: center;
align-items: center;
align-content: center;
width: 100%;
}
.center-img {
text-align: center;
align-items: center;
align-content: center;
}
html {
margin: 10px;
}
body {
font-family: "Times New Roman", serif;
margin: 45mm 8mm 2mm 8mm;
}
.rounded-pill {
border: solid 1px #86895D;
border-radius: 10px;
background-color: #86895D;
color: #fff !important;
margin: 5px;
}
</style>
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
How can I add external css to generate PDF using view file? Can you please help me in this?