I already did this with external css. but when i tried to do with inline CSS it wont work.
我已经用外部css做过了。但是当我尝试使用内联CSS时,它不起作用。
Can i use inline css in mPdf while creating PDF? Guide me please.
在创建PDF时,我可以在mPdf中使用内联css吗?请指引我。
2 个解决方案
#1
1
According to the mPDF documentation, yes :
根据mPDF文件,是的:
The following are supported (in order of ascending priority - lower ones in list overwrite higher):
支持以下内容(按升序优先级-列表中较低的内容覆盖较低的内容):
HTML attributes e.g.
<div align="center">
(see supported HTML attributes)HTML属性,例如
(参见支持的HTML属性)CSS Stylesheets - included in header of HTML document or as
<link />
or as@import()
CSS样式表——包含在HTML文档的标题中或作为 或作为@import()
- html tags e.g.
p { font-size:12pt; color:#880000; }
- html标签,如p {font-size:12pt;颜色:# 880000;}
- class e.g.
.stylename { font-size:9pt; }
- 类,如.stylename {font-size:9pt;}
- id e.g.
#style { font-size:9pt; }
- id = #style {font-size:9pt;}
In-line CSS style e.g.
<p style="font-family:monospace;">
line - height: 130%; font-family:宋体
(Emphasis mine)
(强调我的)
#2
0
With mpdf,add the css with below
使用mpdf,添加css如下
$styles = file_get_contents('style.css');
$风格= file_get_contents(“style.css”);
$mpdf->WriteHTML($styles,1);
mpdf - > WriteHTML美元($风格,1);
#1
1
According to the mPDF documentation, yes :
根据mPDF文件,是的:
The following are supported (in order of ascending priority - lower ones in list overwrite higher):
支持以下内容(按升序优先级-列表中较低的内容覆盖较低的内容):
HTML attributes e.g.
<div align="center">
(see supported HTML attributes)HTML属性,例如
(参见支持的HTML属性)CSS Stylesheets - included in header of HTML document or as
<link />
or as@import()
CSS样式表——包含在HTML文档的标题中或作为 或作为@import()
- html tags e.g.
p { font-size:12pt; color:#880000; }
- html标签,如p {font-size:12pt;颜色:# 880000;}
- class e.g.
.stylename { font-size:9pt; }
- 类,如.stylename {font-size:9pt;}
- id e.g.
#style { font-size:9pt; }
- id = #style {font-size:9pt;}
In-line CSS style e.g.
<p style="font-family:monospace;">
line - height: 130%; font-family:宋体
(Emphasis mine)
(强调我的)
#2
0
With mpdf,add the css with below
使用mpdf,添加css如下
$styles = file_get_contents('style.css');
$风格= file_get_contents(“style.css”);
$mpdf->WriteHTML($styles,1);
mpdf - > WriteHTML美元($风格,1);