Php 使用TCPDF时出现问题

Php 使用TCPDF时出现问题,php,tcpdf,Php,Tcpdf,当我这样做时: $html = '<div style="color: red; border: solid 2px blue; width: 100px; height: 200px;">Hello World!</div>'; $pdf->writeHTML($html, true, 0, true, true); $html='Hello World!'; $pdf->writeHTML($html,true,0,true,true); 我得到以下div:

当我这样做时:

$html = '<div style="color: red; border: solid 2px blue; width: 100px; height: 200px;">Hello World!</div>';
$pdf->writeHTML($html, true, 0, true, true);
$html='Hello World!';
$pdf->writeHTML($html,true,0,true,true);
我得到以下div:


它不是
宽度:100px;高度:200px如图中所示。为什么我的样式不能正常工作?

这大概是因为TCPDF不支持每个CSS样式元素/度量单位的精确HTML到PDF转换

如果此问题尚未解决,您可以尝试在项目页面上打开一个bug。

Limur


Tcpdf不支持宽度和高度css属性以使pdf文件成为最佳解决方案是放置特定图像而不是设置宽度和高度。

您是否尝试过使用绝对测量值,例如
cm
mm
,而不是像素?(即:
高度:2cm;
等)