Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php DomPDF错误未捕获异常';Dompdf\Exception';_Php_Css_Pdf_Dompdf - Fatal编程技术网

Php DomPDF错误未捕获异常';Dompdf\Exception';

Php DomPDF错误未捕获异常';Dompdf\Exception';,php,css,pdf,dompdf,Php,Css,Pdf,Dompdf,我的DOMPDF有问题 我正在尝试使用DOMPDF生成一个表 错误消息: 找不到第1行 完整的错误报告: > Fatal error: Uncaught exception 'Dompdf\Exception' 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.

我的
DOMPDF
有问题

我正在尝试使用
DOMPDF
生成一个表

错误消息:

找不到第1行

完整的错误报告:

>     Fatal error: Uncaught exception 'Dompdf\Exception' 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):
> Dompdf\Cellmap->get_frame_height(Object(Dompdf\FrameDecorator\TableRow))
>     #1 /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> Dompdf\FrameReflower\TableRow->reflow(NULL) #2
> /var/www/dompdf/src/FrameReflower/TableRowGroup.php(51):
> Dompdf\FrameDecorator\AbstractFrameDecorator->reflow() #3
> /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> Dompdf\FrameReflower\TableRowGroup->reflow(NULL) #4
> /var/www/dompdf/src/FrameReflower/Table.php(489):
> Dompdf\FrameDecorator\AbstractFrameDecorator->reflow() #5
> /var/www/dompdf/src/FrameDecorator/AbstractFrameDecorator.php(894):
> Dompdf\FrameReflower\Table->reflow(Object(Dompdf\FrameDecorator\Block))
>     #6 /var/www/dompdf/src/FrameReflower/Block.php(845): Dompdf\FrameDecorator\AbstractFrameDecorator->reflo in
> /var/www/dompdf/src/Cellmap.php on line 415
这是我的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>
        <div class="ueberschrift">Rechnung</div>
        <table id="table">
            <thead class="thead-dark">
                <tr class="tr-head">
                    <div class="border-line-bottom">
                        <th scope="col" class="th-head">Stückzahl</th>
                        <th scope="col" class="th-head">Preis</th>
                        <th scope="col" class="th-head">Artikel</th>
                    </div>
                </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>
我认为问题可能在于 显示:内联块#表中。tr正文td:n个孩子(3) 当我移除显示标签时,它可以正常工作


感谢您的帮助

尝试删除
显示:内联块来自CSS中的th和td。
从
thead
中删除不必要的
,正如@fatfredy在回答中所说的那样


当您使用值
inline block
覆盖th/td显示时,表中的css不是您期望的行为。

可能是第一次tr后的div,尝试一下,删除打开和关闭div@FatFreddy我试过了,但不管用,谢谢。它似乎工作得很好。如果我有问题或类似的事情,我会回来找你
@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;
}