我正在尝试根据所需的产品数量生成pdf文件 .
$html2pdf->writeHTML($this->render($template, array(
'offerte' => $offerte,
'customer' => $customer
))->getContent());
try {
$html2pdf->output();
} catch (Html2PdfException $e) {
}
在html.twig文件中,我循环遍历$ offerte对象中的对象数量 . 但是当我的对象超过页面高度时,我得到502坏网关崩溃 . 因此,当我有一个表行时它工作得很好,但是当我有40行并且它比1 pdf页面大时,它会保持加载和崩溃 . 检查日志后,出现最大执行错误:
request.CRITICAL:未捕获的PHP异常Symfony \ Component \ Debug \ Exception \ FatalErrorException:“错误:超过30秒的最大执行时间”在/var/www/todo-symfony/vendor/tecnickcom/tcpdf/tcpdf.php第7776行{“exception”:“[object](Symfony \ Component \ Debug \ Exception \ FatalErrorException(code:0):错误:/ var / www / todo-symfony / vendor / tecnickcom / tcpdf /超过30秒的最大执行时间tcpdf.php:7776)“} []
当我在1页上有太多表行时,有没有办法启动新页面,或者出于另一个原因出现此错误?
我的html.twig模板文件正在加载:
<page backtop="7mm" backbottom="7mm" backleft="10mm" backright="10mm">
<page_header>
<img class="banner" src="img/cue/offerte_header.JPG"/><br>
<div class="row customer_info">
<table>
<tbody>
<tr>
<td width="90">Naam :</td>
<td width="225">{{ customer.firstName }} {{ customer.lastName }}</td>
<td width="90">Lever adres :</td>
<td width="225">{{ offerte.deliveryaddress }} {{ offerte.postcode }} {{ offerte.place }}</td>
</tr>
<tr>
<td width="90">Adres :</td>
<td width="225">{{ customer.address }} {{ customer.postcode }} {{ customer.place }}</td>
<td width="90">Lever datum :</td>
<td width="225">{{ offerte.deliverydate|date("d/m/Y") }}</td>
</tr>
<tr>
<td>Telefoon :</td>
<td>{{ customer.phone }}</td>
</tr>
</tbody>
</table>
</div>
<table class="data_table" width="780px">
<col width="50">
<col width="505">
<col width="50">
<col width="50">
<col width="50">
<thead>
<tr>
<th align="center" class="data_table">Code</th>
<th align="center" class="data_table">Omschrijving</th>
<th align="center" class="data_table">Aantal</th>
<th align="center" class="data_table">Prijs</th>
<th align="center" class="data_table">Totaal</th>
</tr>
</thead>
<tbody>
{% set totaal = 0 %}
{% for object in offerte.objects %}
<tr>
<td class="data_table">{{ object.code }}</td>
<td class="data_table"><pre>{{ object.omschrijving }}</pre></td>
<td class="data_table">{{ object.aantal }}</td>
<td class="data_table">€ {{ object.prijs }}</td>
<td class="data_table">€ {{ object.totaal }}</td>
{#{% set totaal = totaal + object.totaal %}#}
</tr>
{% endfor %}
<tr>
<td></td>
<td></td>
<td colspan="2" align="right" class="left-center">Subtotaal</td>
<td class="data_table_foot">€ {{ totaal }} </td>
</tr>
<tr>
<td></td>
<td></td>
<td colspan="2" align="right" class="left-center">Korting</td>
<td class="data_table_foot">{{ offerte.korting }} %</td>
</tr>
<tr>
<td></td>
<td colspan="3" align="right" class="left-center">Opbouw/afbouw + transport</td>
<td class="data_table_foot">€ {{ offerte.extracost }} </td>
</tr>
<tr>
<td></td>
<td colspan="3" align="right" class="left-center">BTW</td>
<td class="data_table_foot">{{ offerte.btw }} %</td>
</tr>
<tr>
<td></td>
<td colspan="3" align="right" class="left-center">Totaal</td>
{#{% set h1 = totaal - (totaal / 100 * offerte.korting) %}#}
{#{% set h2 = h1 + offerte.extracost %}#}
{#{% set h3 = h2 + (h2 / 100 * offerte.btw) %}#}
<td class="data_table_foot">€ {{ h3|round(2) }} </td>
</tr>
</tbody>
</table>
</page_header>
<page_footer>
<img class="bannerfooter" src="img/cue/offerte_footer.JPG"/><br>
</page_footer>