From f8c923b48a81a011f103e930b675188cf22e972d Mon Sep 17 00:00:00 2001 From: nexxo Date: Wed, 29 Jul 2026 01:45:55 +0200 Subject: [PATCH] Stop the invoice printing my own indentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TCPDF takes leading whitespace in HTML literally, so every line of the address and every line description came out indented by however far the Blade template happened to be nested — and the one line that had no indentation, the VAT number, sat flush against the margin looking like the mistake. It was the only correct one. Also puts the title and the invoice number in one block. As an h1 with a paragraph beneath it, TCPDF gave the heading a margin of its own and the two drifted a centimetre apart. Found by rendering the page and looking at it, which is the only way any of this is ever found. Co-Authored-By: Claude Opus 5 --- resources/views/pdf/invoice.blade.php | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/resources/views/pdf/invoice.blade.php b/resources/views/pdf/invoice.blade.php index 2cc599e..b6bca60 100644 --- a/resources/views/pdf/invoice.blade.php +++ b/resources/views/pdf/invoice.blade.php @@ -32,15 +32,10 @@ - +{{-- No leading whitespace inside these cells. TCPDF prints it: every indented + line came out indented, and only the last one — which had none — sat flush + against the margin. --}} +
- {{ $customer['name'] ?? '' }}
- {{ $customer['address'] ?? '' }}
- {{ trim(($customer['postcode'] ?? '').' '.($customer['city'] ?? '')) }}
- {{ $customer['country'] ?? '' }} - @if (! empty($customer['vat_id'])) -
{{ __('invoice.customer_vat') }}: {{ $customer['vat_id'] }} - @endif -
{{ $customer['name'] ?? '' }}
{{ $customer['address'] ?? '' }}
{{ trim(($customer['postcode'] ?? '').' '.($customer['city'] ?? '')) }}
{{ $customer['country'] ?? '' }}@if (! empty($customer['vat_id']))
{{ __('invoice.customer_vat') }}: {{ $customer['vat_id'] }}@endif
@@ -66,8 +61,11 @@ @endif -

{{ $meta['title'] ?? __('invoice.title') }}

-

{{ $meta['number'] ?? '' }}

+{{-- One block, not a heading with a paragraph beneath it: TCPDF gives an h1 a + margin of its own and the two drifted a centimetre apart. --}} + + +
{{ $meta['title'] ?? __('invoice.title') }}
{{ $meta['number'] ?? '' }}
@if (! empty($meta['salutation']))

{{ $meta['salutation'] }}

@@ -95,12 +93,7 @@ @endphp {{ $index + 1 }} - - {{ $line['description'] ?? '' }} - @foreach (($line['details'] ?? []) as $detail) -
{{ $detail }} - @endforeach - + {{ $line['description'] ?? '' }}@foreach (($line['details'] ?? []) as $detail)
{{ $detail }}@endforeach {{ InvoiceMath::quantity((int) $line['quantity_milli']) }}@if (! empty($line['unit'])) {{ $line['unit'] }}@endif {{ InvoiceMath::money((int) $line['unit_net_cents']) }} {{ InvoiceMath::money($net) }}