DomPDF Error Uncaught exception 'DompdfException'

Multi tool use
Multi tool use


DomPDF Error Uncaught exception 'DompdfException'



I have a Problem with my DOMPDF.


DOMPDF



I'm trying to generate a table with DOMPDF.


DOMPDF



Error message :



The row #1 could not be found



Complete error report :


> Fatal error: Uncaught exception 'DompdfException' with message 'The row #1 could not be found, please file an issue in the tracker
> with the HTML code' in /var/www/dompdf/src/Cellmap.php:415 Stack
> trace: #0 /var/www/dompdf/src/FrameReflower/TableRow.php(62):
> DompdfCellmap->get_frame_height(Object(DompdfFrameDecoratorTableRow))
> #1 /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> DompdfFrameReflowerTableRow->reflow(NULL) #2
> /var/www/dompdf/src/FrameReflower/TableRowGroup.php(51):
> DompdfFrameDecoratorAbstractFrameDecorator->reflow() #3
> /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> DompdfFrameReflowerTableRowGroup->reflow(NULL) #4
> /var/www/dompdf/src/FrameReflower/Table.php(489):
> DompdfFrameDecoratorAbstractFrameDecorator->reflow() #5
> /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> DompdfFrameReflowerTable->reflow(Object(DompdfFrameDecoratorBlock))
> #6 /var/www/dompdf/src/FrameReflower/Block.php(845): DompdfFrameDecoratorAbstractFrameDecorator->reflo in
> /var/www/dompdf/src/Cellmap.php on line 415



Here is my HMTL


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="styles.css">
<title>Rechnung</title>
</head>
<footer>Footer on every page</footer>
<header>
<img src="lib/gfx/xx.jpg" style="width: 30%; float:left;" alt="xx">
<p style="width: 30%; float:right; margin-right: 5px;">
xxxx xxxx GmbH
<br>XXXX xx
<br>XXX XXX
<br>Deutschland
</p>
</header>
<body>
<main>

Rechnung

<table id="table">
<thead class="thead-dark">
<tr class="tr-head">

Stückzahl
Preis
Artikel

</tr>
</thead>
<tbody>
<tr class="tr-body">
<td class="td-body">1</td>
<td class="td-body">12</td>
<td class="td-body">23</td>
</tr>
</tbody>
</table>
</main>
</body>
</html>



And here is my CSS


@page
{
margin: 100px 25px;
}

header {
position: fixed;
top: -60px;
left: 0px;
right: 0px;
height: 100px;
border-bottom: 1px solid black;
}

footer {
position: fixed;
bottom: -60px;
left: 0px;
right: 0px;
height: 50px;
}

p {
page-break-after: always;
}

p:last-child {
page-break-after: never;
}

.ueberschrift {
margin-top: 10%;
display: block;
margin-left: 45%;
font-size: 20px;
font-weight: bold;
}

#table {
width: 100%;
}

.thead-dark {
color: black;
width: 100%;
}

.th-head {
display: inline-block;
margin-left: -20%;
}

#table .thead-dark th:nth-child(1) {
display: inline-block;
margin-left: 20px;
}

#table .thead-dark th:nth-child(2) {
display: inline-block;
margin-left: 90px;
}

#table .thead-dark th:nth-child(3) {
display: inline-block;
margin-left: 170px;
}

/*
CSS für die Werte -> td
*/

#table .tr-body td:nth-child(1) {
display: inline-block;
margin-left: 20px;
}


#table .tr-body td:nth-child(2) {
display: inline-block;
margin-left: 90px;
}

#table .tr-body td:nth-child(3) {
display: inline-block;
width: 10%;
background: red;
}

.border-line-bottom {
width: 90%;
margin: 0 auto;
border-bottom: 1px solid black;
}



I think the problem might be the
display: inline-block
at #table .tr-body td:nth-child(3)
When i remove the display tag it works without a problem.



Thanks for help





maybe the div after the first tr, give it a try, remove the opening <div class="border-line-bottom"> and closing div
– FatFreddy
Jul 2 at 10:59





@FatFreddy i tried it and it doesnt work
– xEmrah
Jul 2 at 11:08




1 Answer
1



Try to remove the display: inline-block; from the th and the td in your CSS.
And remove the unnecessary <div class="border-line-bottom"> from the thead as @FatFreddy said in his answer.


display: inline-block;


<div class="border-line-bottom">


thead



When you overwrite the th/td display with the value inline-block the css from the table is not the behavior as you want to expect.


inline-block





Thanks alot. It seems to work fine . If i have problems or something like that i'll be back for you
– xEmrah
Jul 2 at 11:43







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Flj gnpzK9AcL,ADTDB9 s4rvEjUhSBO,PHlk0CD6z vFnvbp YXBSL3EfoYI,OuX2k 0jCI
fIxabmD70Of sdaV3YS,gU5qJzSDJ1aDlKhv,moafoV use4xQYKzJAd0Xs,KCPSPz,QJrso87W B1,dh

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications