barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.75k stars 974 forks source link

Update from v0.8.7 to 2.0.1 i have issue on layout #998

Open essteffan opened 1 year ago

essteffan commented 1 year ago

Hey Guys, I have updated laravel-dompdf from v0.8.7 to any version above 1.x and my generating templates are broken.

If i downgrade to 0.8.7 it is working but otherwise i have a broken pdf result image

My code is this one (i delete some parts of it because of logic but in this form is still broken)

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <style>
        *{ font-family: DejaVu Sans, sans-serif; font-size: 12px; width: 100%;}
        /** Define the margins of your page **/
        @page {
            margin: 30px 25px 30px 25px;
        }

        header {
            position: fixed;
            top: -30px;
            left: 0px;
            right: 0px;
            height: 100px;
        }

        footer {
            position: fixed;
            bottom: -20px;
            left: 0px;
            right: 0px;
            height: 20px;
            margin: 0 9px;
            border: none !important;
        }
        footer table{
            border: none !important;
        }

        p{
            text-indent: 20px;
        }
        p:last-child {
            page-break-after: initial;
        }

        table{
            border-collapse: collapse;
        }
        table td {
            border: 1px solid #000000;
        }
        table, tbody > tr, tbody td {
            border: 1px solid #000000;
        }
        tbody > td{
            padding: 0 5px;
        }
        .border-top{
            border-top: 1px solid #000000;
        }

        .pagenum:before {
            content: counter(page);
        }

    </style>
</head>
    <body>
        <footer>
            <table>
                <thead>
                <tr>
                    <td style="width: 90%">Evaluator: S.C. WORKIT INOVATION S.R.L., Tel. 0749053249, www.workitromania.ro,e-mail: office@workitromania.ro</td>
                    <td style="text-align: right; width: 10%;">Pag. <span class="pagenum"></span></td>
                </tr>
                </thead>
            </table>
        </footer>

        <main>
                <table style="table-layout: fixed; ">
                    <thead style="border: 1px solid #000000">
                        <tr>
                            <td colspan="3" align="left">
                                Unitatea:   {{ $partner->name }} <br>
                                Loc munca:  {{ $workplace }}
                            </td>
                            <td colspan="2" align="center">
                                @if($date){{ ucwords(strftime('%B',$date)) }} {{ strftime('%Y',$date) }}@else{{ ucwords(strftime('%B',time())) }} {{ strftime('%Y',time()) }}@endif
                                <br>
                                Ver {{ $version }}<br>
                                Aprobat, <br>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="5" align="center"><h3><b>PLAN DE PREVENIRE SI PROTECTIE</b></h3></td>
                        </tr>
                        <tr class="border-top">

                            <th style="width: 10px; text-align: center">Nr.<br>crt.</th>
                            <th style="text-align: center">
                                LOC DE MUNCA / POST DE LUCRU. <br>
                                RISCURI EVALUATE
                            </th>
                            <th>
                                <table style="table-layout: fixed; border: 0">
                                    <thead>
                                    <tr>
                                        <td colspan="2" align="center" style="border-bottom: 1px solid #000000;">
                                            MASURI <br>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td align="left" style="width: 50px;">
                                            Tehnica<br>
                                            Organizatorica<br>
                                            Ig.-sanitara<br>
                                            Alta natura
                                        </td>
                                        <td style="width: 50px;">
                                            DESCRIERE / Actiuni in scopul realizarii masurii / OBS
                                        </td>
                                    </tr>
                                    </thead>
                                </table>
                            </th>
                            <th style="text-align: center; width: 20px;">TERMEN DE <br> REALIZARE</th>
                            <th style="text-align: center; width: 20px">PERSOANA RESPONSABILA</th>
                        </tr>
                    </thead>
                </table>
        </main>
    </body>
</html>

Any idea what changed?

Thank you in advanced for the help

radcloudcorp commented 1 year ago

essteffan

The same case happened here. I upgraded from version 0.9.0 to 2.0.1 and all print templates are broken.

ericcch commented 10 months ago

Same thing here

parallels999 commented 10 months ago

https://github.com/barryvdh/laravel-dompdf/blob/424a223ce80e7afc8bfb6e84449679efe272fbb5/.github/ISSUE_TEMPLATE/bug_report.md?plain=1#L10-L12

This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters/html/css etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.