如何在dompdf中应用引导样式 [英] How to apply bootstrap style in dompdf
问题描述
我正在使用引导网格来显示,我希望我的客户端以pdf格式下载它,因此我正在使用dompdf,但dompdf无法应用引导样式.我无法返回并将引导网格转换为基本的html表,并使用其他插件转换为pdf,我发现它们既困难又耗时(尤其是在安装作曲机然后更新我是new的过程中),因此我可以轻松地将引导样式应用于我的pdf
I'm using bootstrap grid to display and i want that my client download it in pdf so for that i'm using dompdf but dompdf is not able to apply bootstrap style. I cannot go back and turn my bootstrap grid to basic html tables and using different plugin to convert to pdf i found them difficult and time consuming(especially in installing composer and then updating i'm new ) is there any way out so that i can easily apply bootstrap style to my pdf
$pr_dt=$_POST['hid'];//div elements which i want ot convert them to pdf and also contain bootstap lib link
include_once("../assets/converter/dompdf/dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html($pr_dt);
$dompdf->render();
$dompdf->stream("MRA.pdf");
或至少没有任何在线转换器可将引导表格网格转换为html表
or at least is there any online converter for bootstrap grid to html tables
推荐答案
您需要确保dompdf可以找到您的CSS文件.您可以使用 set_base_path
进行此操作,例如:
You need to make sure dompdf can find your CSS files. You can do this with set_base_path
, for example:
$dompdf->set_base_path("/www/public/css/");
您还需要指定CSS文件,例如:
You also need a to specify the CSS file, something like:
<html>
<head>
<link type="text/css" href="style.css" rel="stylesheet" />
</head>
<body>
...
这篇关于如何在dompdf中应用引导样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!