以下内容:
在cellmap中找不到框架
https://github.com/dompdf/dompdf/issues/657
互联网上是一个众所周知的问题。但我找不到解决方案
对于这个问题。我正在尝试将我的html模板转换为pdf。当我删除<table>
它正在工作时。否则会引发异常。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Example 2</title>
<link rel="stylesheet" href="/administration/style.css" media="all" />
</head>
<body>
<header class="clearfix">
<div id="logo">
<img src="/administration/logo.png">
</div>
<div id="company">
<h2 class="name">Company Name</h2>
<div>455 Foggy Heights, AZ 85004, US</div>
<div>(602) 519-0450</div>
<div><a href="mailto:company@example.com">company@example.com</a></div>
</div>
</div>
</header>
<main>
<div id="details" class="clearfix">
<div id="client">
<div class="to">INVOICE TO:</div>
<h2 class="name">John Doe</h2>
<div class="address">796 Silver Harbour, TX 79273, US</div>
<div class="email"><a href="mailto:john@example.com">john@example.com</a></div>
</div>
<div id="invoice">
<h1>INVOICE 3-2-1</h1>
<div class="date">Date of Invoice: 01/06/2014</div>
<div class="date">Due Date: 30/06/2014</div>
</div>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="no">#</th>
<th class="desc">DESCRIPTION</th>
<th class="unit">UNIT PRICE</th>
<th class="qty">QUANTITY</th>
<th class="total">TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<td class="no">01</td>
<td class="desc"><h3>Website Design</h3>Creating a recognizable design solution based on the company's existing visual identity</td>
<td class="unit">$40.00</td>
<td class="qty">30</td>
<td class="total">$1,200.00</td>
</tr>
<tr>
<td class="no">02</td>
<td class="desc"><h3>Website Development</h3>Developing a Content Management System-based Website</td>
<td class="unit">$40.00</td>
<td class="qty">80</td>
<td class="total">$3,200.00</td>
</tr>
<tr>
<td class="no">03</td>
<td class="desc"><h3>Search Engines Optimization</h3>Optimize the site for search engines (SEO)</td>
<td class="unit">$40.00</td>
<td class="qty">20</td>
<td class="total">$800.00</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="1"></td>
<td colspan="1">SUBTOTAL</td>
<td>$5,200.00</td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="1">TAX 25%</td>
<td>$1,300.00</td>
</tr>
<tr>
<td colspan="1"></td>
<td colspan="1">GRAND TOTAL</td>
<td>$6,500.00</td>
</tr>
</tfoot>
</table>
<div id="thanks">Thank you!</div>
<div id="notices">
<div>NOTICE:</div>
<div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div>
</div>
</main>
<footer>
Invoice was created on a computer and is valid without the signature and seal.
</footer>
</body>
</html>
答案 0 :(得分:0)
我遇到了类似的问题,但是发现其中一个文本项中有一个额外的<
(文本是由用户输入的,因此他们有一个年龄问题,例如{{ 1}}。确保您逃避了这些错误(在PHP中,使用Are you < 21 years old
)。
无效的html或额外的HTML标记也可能发生这种情况。我浏览了您上面的htmlentities
并通过dompdf进行了运行,但是它没有引发错误,所以也许您的代码中有一个错误的<table>
没有复制到StackOverflow?
答案 1 :(得分:-1)
解决方案:
使用它:
$orientation = 'landscape';
$customPaper = array(0,0,950,950);
$this->setPaper($customPaper, $orientation);