string) {
return {
@@ -27,16 +27,20 @@ export function cssLength(t: (key: string) => string) {
}
}
-/** Matches the defaults in config/pdf.php, including dompdf's own 1.2cm margin. */
+/**
+ * Matches the defaults in config/pdf.php. Margins are zero because the stock
+ * templates own their own spacing, and a full-bleed header only reaches the
+ * paper edge when the page margin is nothing.
+ */
export function pageSetupDefaults(): PdfPageSetup {
return {
pdf_paper_width: '210mm',
pdf_paper_height: '297mm',
pdf_orientation: 'portrait',
- pdf_margin_top: '1.2cm',
- pdf_margin_right: '1.2cm',
- pdf_margin_bottom: '1.2cm',
- pdf_margin_left: '1.2cm',
+ pdf_margin_top: '0',
+ pdf_margin_right: '0',
+ pdf_margin_bottom: '0',
+ pdf_margin_left: '0',
pdf_page_numbers: false,
}
}
diff --git a/resources/views/app/pdf/estimate/estimate1.blade.php b/resources/views/app/pdf/estimate/estimate1.blade.php
index 3ad2a7cb..83a545d3 100644
--- a/resources/views/app/pdf/estimate/estimate1.blade.php
+++ b/resources/views/app/pdf/estimate/estimate1.blade.php
@@ -10,12 +10,7 @@
@@ -455,7 +479,7 @@
-
+
@include('app.pdf.estimate.partials.table')
diff --git a/resources/views/app/pdf/estimate/estimate2.blade.php b/resources/views/app/pdf/estimate/estimate2.blade.php
index 1dc3b203..1f5074e0 100644
--- a/resources/views/app/pdf/estimate/estimate2.blade.php
+++ b/resources/views/app/pdf/estimate/estimate2.blade.php
@@ -9,12 +9,7 @@
@@ -459,7 +481,9 @@
- @include('app.pdf.estimate.partials.table')
+
+ @include('app.pdf.estimate.partials.table')
+
@if ($notes)
diff --git a/resources/views/app/pdf/estimate/estimate3.blade.php b/resources/views/app/pdf/estimate/estimate3.blade.php
index 7a81eca8..eea2b580 100644
--- a/resources/views/app/pdf/estimate/estimate3.blade.php
+++ b/resources/views/app/pdf/estimate/estimate3.blade.php
@@ -10,12 +10,7 @@
@@ -408,7 +433,9 @@
- @include('app.pdf.estimate.partials.table')
+
+ @include('app.pdf.estimate.partials.table')
+
@if ($notes)
diff --git a/resources/views/app/pdf/estimate/partials/table.blade.php b/resources/views/app/pdf/estimate/partials/table.blade.php
index 30d3dd13..06e3fc38 100644
--- a/resources/views/app/pdf/estimate/partials/table.blade.php
+++ b/resources/views/app/pdf/estimate/partials/table.blade.php
@@ -1,3 +1,8 @@
+{{-- Inset lives on this div, not on the table: the table sets
+ border-collapse: collapse, and padding does not apply to a table in
+ that mode. dompdf applies it anyway, Chromium follows the spec. The hr
+ and the totals block below carry their own insets already. --}}
+
| # |
@@ -69,6 +74,7 @@
@endphp
@endforeach
+
diff --git a/resources/views/app/pdf/invoice/invoice1.blade.php b/resources/views/app/pdf/invoice/invoice1.blade.php
index 803f6aa1..c1e1e18f 100644
--- a/resources/views/app/pdf/invoice/invoice1.blade.php
+++ b/resources/views/app/pdf/invoice/invoice1.blade.php
@@ -10,12 +10,7 @@
@@ -393,7 +418,7 @@
@endif
-
+
@include('app.pdf.invoice.partials.table')
diff --git a/resources/views/app/pdf/invoice/invoice2.blade.php b/resources/views/app/pdf/invoice/invoice2.blade.php
index 3d4c467f..2ff4937e 100644
--- a/resources/views/app/pdf/invoice/invoice2.blade.php
+++ b/resources/views/app/pdf/invoice/invoice2.blade.php
@@ -9,13 +9,7 @@
@@ -433,7 +453,9 @@
- @include('app.pdf.invoice.partials.table')
+
+ @include('app.pdf.invoice.partials.table')
+
@if ($notes)
diff --git a/resources/views/app/pdf/invoice/invoice3.blade.php b/resources/views/app/pdf/invoice/invoice3.blade.php
index 059fff35..bfd12ba1 100644
--- a/resources/views/app/pdf/invoice/invoice3.blade.php
+++ b/resources/views/app/pdf/invoice/invoice3.blade.php
@@ -11,12 +11,7 @@
/* -- Base -- */
body {
- }
-
- html {
margin: 0px;
- padding: 0px;
- margin-top: 50px;
}
table {
@@ -31,9 +26,10 @@
/* -- Header -- */
.header-container {
- margin-top: -30px;
+ position: relative;
+ margin-top: 0px;
width: 100%;
- padding: 0px 30px;
+ padding: 20px 30px 0px;
}
.header-logo {
@@ -132,9 +128,23 @@
/* -- Items Table -- */
+ /* The items table sets border-collapse: collapse, and padding does not
+ apply to a table in that mode. dompdf applies it anyway, Chromium
+ follows the spec and drops it, which put the two renderers 22.5pt
+ apart on each side. All of the table's spacing lives on this wrapper
+ instead -- a plain block, honoured identically by both. Padding rather
+ than margin so nothing collapses through it either. */
+ .items-table-wrapper {
+ padding-top: 35px;
+ padding-bottom: 10px;
+ }
+
+ .items-table-inset {
+ padding-left: 30px;
+ padding-right: 30px;
+ }
+
.items-table {
- margin-top: 35px;
- padding: 0px 30px 10px 30px;
page-break-before: avoid;
page-break-after: auto;
}
@@ -307,6 +317,20 @@
padding-left: 0;
}
+ /* The address formats emit
{NAME}
ahead of the
-joined
+ lines. Left to the user-agent default its margins differ between
+ dompdf and Chromium -- the construct where the two renderers drift
+ apart vertically -- and the extra top margin also pushes the company
+ column out of line with the Bill to / Ship to columns beside it.
+ Pinning both margins fixes the alignment and removes the divergence. */
+ .company-address h3,
+ .customer-address-container h3,
+ .billing-address h3,
+ .shipping-address h3 {
+ margin-top: 0;
+ margin-bottom: 6px;
+ }
+
@@ -369,7 +393,9 @@
- @include('app.pdf.invoice.partials.table')
+
+ @include('app.pdf.invoice.partials.table')
+
@if ($notes)
diff --git a/resources/views/app/pdf/invoice/partials/table.blade.php b/resources/views/app/pdf/invoice/partials/table.blade.php
index 80ae5db6..85704087 100644
--- a/resources/views/app/pdf/invoice/partials/table.blade.php
+++ b/resources/views/app/pdf/invoice/partials/table.blade.php
@@ -1,3 +1,8 @@
+{{-- Inset lives on this div, not on the table: the table sets
+ border-collapse: collapse, and padding does not apply to a table in
+ that mode. dompdf applies it anyway, Chromium follows the spec. The hr
+ and the totals block below carry their own insets already. --}}
+
| # |
@@ -86,6 +91,7 @@
@endphp
@endforeach
+
diff --git a/resources/views/app/pdf/payment/payment.blade.php b/resources/views/app/pdf/payment/payment.blade.php
index 1155d00b..35de3b75 100644
--- a/resources/views/app/pdf/payment/payment.blade.php
+++ b/resources/views/app/pdf/payment/payment.blade.php
@@ -10,13 +10,7 @@
diff --git a/resources/views/app/pdf/reports/expenses.blade.php b/resources/views/app/pdf/reports/expenses.blade.php
index c8f4d0fb..cd5ae356 100644
--- a/resources/views/app/pdf/reports/expenses.blade.php
+++ b/resources/views/app/pdf/reports/expenses.blade.php
@@ -7,6 +7,7 @@