mccarlosen / laravel-mpdf

Generate PDFs in Laravel with Mpdf.
402 stars 107 forks source link

Getting Undefined array key 2 #97

Closed ZayRTun closed 1 year ago

ZayRTun commented 2 years ago

I get Undefined array key 2 when I use page-break-inside: avoid;. Please help....

<div style="padding-bottom: 30px; page-break-inside: avoid;">
    <div class="mt-8">
        <div style="float: left; width: 50%;" class="text-xs">
            <div style="float: left; width: 20%;">
                <div>Reg No: {{ $record->inhouse_id }}</div>
                <div>Room No: {{ $record->room_no }}</div>
            </div>
            <div style="float: left; width: 50%;">
                <div>Agent: {{ $record->agent_name }}</div>
                <div>Guest Name: {{ $record->guest_name }}</div>
            </div>
        </div>
        <div style="float: right; width: 50%;" class="text-right text-xs">
            <div>
                Total : {{ $ledger->sum('amount_mmk') . ' (MMK)' }}
            </div>
            <div>
                {{ $ledger->sum('amount_usd') . ' (USD)' }}
            </div>
        </div>
        <div style="clear: both; margin: 0pt; padding: 0pt; "></div>
    </div>
    <table border="1" style="width: 100%; border-collapse: collapse">
        <thead>
            <x-tr-mpdf-bg-primary>
                <x-th-mpdf>Date</x-th-mpdf>
                <x-th-mpdf>Description</x-th-mpdf>
                <x-th-mpdf>Reference</x-th-mpdf>
                <x-th-mpdf>Amount (MMK)</x-th-mpdf>
                <x-th-mpdf>Amount (USD)</x-th-mpdf>
            </x-tr-mpdf-bg-primary>
        </thead>
        <tbody class="bg-white text-xs">
            @foreach ($ledger as $record)
                <tr>
                    <x-td-mpdf>{{ $record->date }}</x-td-mpdf>
                    <x-td-mpdf>{{ $record->description }}</x-td-mpdf>
                    <x-td-mpdf>{{ $record->reference }}</x-td-mpdf>
                    <x-td-mpdf>{{ $record->amount_mmk }}</x-td-mpdf>
                    <x-td-mpdf>{{ $record->amount_usd }}</x-td-mpdf>
                </tr>
            @endforeach
        </tbody>
    </table>
</div>
mccarlosen commented 1 year ago

There is not enough information to understand the problem. This doesn't seem to be a problem with laravel-mpdf or with mpdf.

Closed for now. You can reopen it at any time.