vendredi 14 juin 2019

Is DOMPDF right tool for complex Reports?

I'm using barryvdh/laravel-dompdf for creating a Report from a Laravel/Jquery Application and this Report is pretty complex - after the startpage there are a couple of pages which are repeated according to the report data. Every page has a header an footer and i wanted to ask if it's possible to restrict the main content in a way so that it does not overlap with footer or header like this enter image description here

i've tried to insert pagenumbers as well but without any success. This is how my Main-Report-Page looks

<body>


    <table width="100%">
        <tr>
             <td>
                <img src="assets/images/track-more.png" width="200px" height="auto">
              </td>
            <td>
                <img class="logofixed" src="assets/images/frauscher1.png" width="200px" height="auto">
            </td>
        </tr>
    </table>


<h1 class="center">report</h1>


</table>
<div class="page-break"></div>

@foreach ($measures as $measure)
    @include("snippets/razor")
    <div class="page-break"></div>
@endforeach

    <footer>
        <hr>
        <script type="text/php">
    if (isset($pdf)) {
       $font = $fontMetrics->getFont("Arial", "bold");
       $pdf->page_text(555, 745, "Page {PAGE_NUM}/{PAGE_COUNT}", $font,    7, array(0, 0, 0));
    }

    </script>

    </footer>
</body>

My snippets/razor page is like this:

 <div class="row">

    <table>
        <tr>
            @if ($measure->pass == 1)
                <td class="ok"><h1></h1></td><td></td>
            @else
                <td class="fail"><h1></h1></td><td></td>
            @endif
        </tr>
    </table>
    <table>

        <tr>
            <td>date1:</td><td></td>
        </tr>
        <tr>
            <td>date2:</td><td></td>
        </tr>
        <tr>
            <td>date3:</td><td></td>
        </tr>
        <tr>
            <td>date4:</td><td></td>
        </tr>

    </table>
@if(!empty($measure->items))
    <table class="measure">
        <tr>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
            <th>headerx</th>
        </tr>
        @foreach ($measure->items as $i => $item)
            @php  $class = $i % 2 === 0 ? 'even' : 'odd'; @endphp
            <tr class="" >
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                @if ($item->data1== 1)
                    <td class="ok">Success</td>
                @else
                    <td class="fail">Failure</td>
                @endif


                <td></td>
            </tr>
        @endforeach
    </table>
   @endif
</div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire