尝试使用PHP和TCPDF创建正确的PDF文档.
你能帮助我吗,我怎样才能在TCPDF中使用writeHTML函数来创建和居中表?
尝试过:
$html = '
<div style="margin-left: auto; margin-right: auto; width: 50%">
<table border="1" width="200" align="center"><tr><td><b>Invoice number: '.$this->xInvoiceNumber.'</b></td></tr></table>
<br />
<table border="1" width="200" align="center"><tr><td>'.$this->xClient.'</td></tr></table>
<br />
</div>
Run Code Online (Sandbox Code Playgroud)
......但没有运气.
小智 16
您必须创建一个包含3列的表,为每个列设置宽度,在中间创建一个表,您必须创建表.
<table>
<tr>
<td style="width:25%"></td>
<td style="width:50%"><table><tr><td>Your content</td></tr></table></td>
<td style="width:25%"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我并不为这种方法感到骄傲,但它正在工作:)