How does one apply Bootstrap CSS to dompdf? I tried it with $dompdf->set_base_path
but it's not working.
<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap.css" />
How does one apply Bootstrap CSS to dompdf? I tried it with $dompdf->set_base_path
but it's not working.
<link rel="stylesheet" href="vendor/bootstrap/dist/css/bootstrap.css" />
the problem with dom pdf is that it takes the raw html defined on the page itself and combines it with it own default css to build a pdf. to solve this issue you can do various tricks according to the bootstrap version and the dom pdf plugin you are using.
the first way is that you set the default path of dom pdf at run time. you can do this by command
if you are using barryvdh/laravel-dompdf v0.8.2 and Bootstrap v4.0.0. Laravel Cashier creates PDFs by rendering a Blade template. So you could just link to the CDN-hosted version of Bootstrap 4: http://getbootstrap.com/docs/4.1/getting-started/introduction/#css
if you are using any other dom/pdf. you can also change the default css to use by modifying
const DEFAULT_STYLESHEET = "/lib/res/html.css"
at
the most effective way to do this same task is by adding following commmand to your css file during run time.
then this downloads the raw css into your html code.