我使用HTML2PDF扩展来生成PDF(http://html2pdf.fr/) . 尽管PDF生成正常,但它的大小并不合适;没有't matter the width or height I specify for a row or a whole table: the PDF is always generated the same way (with a table width that just fits the cell content)... Here is how I'我试图指定宽度:
<table width="500px" height="20px" style="margin:10px;">
<tr>
<td width="25%"></td>
<td width="50%"></td>
<td width="25%"></td>
</tr>
<tr bgcolor="#EAF8FF">
<td colspan="3">
<strong>Title</strong>
</td>
</tr>
我尝试用以下方法指定宽度:
-
像素("500px")
-
百分比("100%")
-
没有'px'("500")
-
使用'& quot;'标签(是的,我'm aware there is an extra space between '&' and '“')
...等等,但似乎没什么关系......表的大小和宽度始终与它包含的文本成比例 . 但是,“tr”标签中的“bgcolor”和“td”标签中的“colspan”都可以正常工作,所以我不知道会发生什么......我也尝试过指定内部的大小'tr',但没什么......对于我能错过什么的任何想法?
3 回答
你试过"style"属性了吗? html2pdf wiki上的所有示例都具有以下属性:http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:bookmark&s[]=td&s[]=width
您也可以在打开“table”标签后使用“col”标签 . 例如
我有同样的问题,我改变了页边距,特别是在右侧
page backtop =“14mm”backbottom =“14mm”backleft =“8mm”backright =“100mm”