DomPDF отлично не отображает таблицу - программирование

DomPDF отлично не отображает таблицу

Я пытаюсь получить PDF, используя DomPDF, но у меня возникла странная проблема. Все данные и другие вещи прекрасны, но когда он отображается в PDF, первая строка таблицы всегда не соответствует стилю. Во-первых, я могу хотя бы стол перейти на следующую страницу, которые вызывают стиль из контекста, но я попытался ограничить таблицу одной страницей и выяснил, что проблема все еще существует. Итак, первая строка таблицы на каждой странице сходит с ума. Ниже приведен мой код и скриншоты PDF.

контроллер

$dompdf = new DOMPDF();
$dompdf->load_html($listing);
$dompdf->set_paper('a4', 'landscape');
$dompdf->render();
$dompdf->stream("sample.pdf");

Просмотр

<table class="table table-bordered">
    <tr>
        <th width="150">Client </th>
        <td>Client Name </td>
    </tr>

    <tr>
        <th>Site </th>
        <td><?php print $site->title; ?></td>
    </tr>

    <tr>
        <th>Address </th>
        <td>
            <?php 
                print $site->unit.' '.
                $site->street.' '.
                $site->suburb.' '.
                $site->state.' '.
                $site->location; 
            ?>
        </td>
    </tr>

    <tr>
        <th>Post Code </th>
        <td><?php print $site->postcode; ?></td>
    </tr>
    <tr>
        <th colspan="2"> Site Information</th>
    </tr>
    <tr>
        <td colspan="2" height="150"> <?php print $site->site_information; ?></td>
    </tr>
    <tr>
        <th colspan="2">Work Instruction</th>
    </tr>
    <tr>
        <td colspan="2" height="200"> <?php print $site->work_instruction; ?></td>
    </tr>
    <tr>
        <th colspan="2">Equipment on Site</th>
    </tr>
    <tr>
        <td colspan="2"> <?php print $site->site_equipment; ?></td>
    </tr>
    <tr>
        <th colspan="2">Special Instructions</th>
    </tr>
    <tr>
        <td colspan="2" height="100"> <?php print $site->special_instruction; ?></td>
    </tr>
    <tr>
        <th>Contact Person </th>
        <td><?php print $site->contact_person; ?></td>
    </tr>
    <tr>
        <th>Contact Number </th>
        <td><?php print $site->contact_no; ?></td>
    </tr>
</table>

Страница 1: enter image description here

Страница 2: enter image description here

Любая помощь будет высоко оценена. Благодаря

4b9b3361

Ответ 1

Я использую

thead:before, thead:after { display: none; }
tbody:before, tbody:after { display: none; }

Ответ 2

Почти наверняка проблема заключается в использовании Bootstrap. Многие проблемы dompdf, связанные с Bootstrap, связаны с объявлениями :before/:after. Я думаю, вы можете решить проблему в этом конкретном случае, применив следующий CSS для dompdf:

tbody:before, tbody:after { display: none; }