diff --git a/app/Support/PdfHtmlSanitizer.php b/app/Support/PdfHtmlSanitizer.php
index 95d16558..464eaa3b 100644
--- a/app/Support/PdfHtmlSanitizer.php
+++ b/app/Support/PdfHtmlSanitizer.php
@@ -19,6 +19,9 @@ final class PdfHtmlSanitizer
return '';
}
+ // Legacy/invalid `` is dropped by libxml and collapses lines in PDF output; normalize to `
`.
+ $html = str_replace('', '
', $html);
+
$allowedTags = '
', '', $str);
- $str = str_replace('';
$html = strip_tags($html, $allowedTags);
diff --git a/app/Traits/GeneratesPdfTrait.php b/app/Traits/GeneratesPdfTrait.php
index 01105d94..623d33e8 100644
--- a/app/Traits/GeneratesPdfTrait.php
+++ b/app/Traits/GeneratesPdfTrait.php
@@ -180,7 +180,7 @@ trait GeneratesPdfTrait
$str = str_replace('
', $str);
return $str;
}
diff --git a/resources/views/app/pdf/estimate/estimate1.blade.php b/resources/views/app/pdf/estimate/estimate1.blade.php
index cf6676d3..820606ba 100644
--- a/resources/views/app/pdf/estimate/estimate1.blade.php
+++ b/resources/views/app/pdf/estimate/estimate1.blade.php
@@ -436,7 +436,7 @@
')
@@ -446,7 +446,7 @@
@endif
-
diff --git a/resources/views/app/pdf/estimate/estimate2.blade.php b/resources/views/app/pdf/estimate/estimate2.blade.php
index d4f9e976..eb35ab83 100644
--- a/resources/views/app/pdf/estimate/estimate2.blade.php
+++ b/resources/views/app/pdf/estimate/estimate2.blade.php
@@ -444,7 +444,7 @@
{!! $company_address !!}
')
@@ -453,7 +453,7 @@
{!! $billing_address !!}
diff --git a/resources/views/app/pdf/invoice/invoice1.blade.php b/resources/views/app/pdf/invoice/invoice1.blade.php
index deee2831..8573705e 100644
--- a/resources/views/app/pdf/invoice/invoice1.blade.php
+++ b/resources/views/app/pdf/invoice/invoice1.blade.php
@@ -384,7 +384,7 @@
@endif
diff --git a/resources/views/app/pdf/invoice/invoice2.blade.php b/resources/views/app/pdf/invoice/invoice2.blade.php
index a04eb05b..f20296bd 100644
--- a/resources/views/app/pdf/invoice/invoice2.blade.php
+++ b/resources/views/app/pdf/invoice/invoice2.blade.php
@@ -415,7 +415,7 @@
{!! $company_address !!}
')
@@ -425,7 +425,7 @@
@endif
-
{!! $billing_address !!}
diff --git a/resources/views/app/pdf/invoice/invoice3.blade.php b/resources/views/app/pdf/invoice/invoice3.blade.php
index 25dda57d..05893608 100644
--- a/resources/views/app/pdf/invoice/invoice3.blade.php
+++ b/resources/views/app/pdf/invoice/invoice3.blade.php
@@ -343,7 +343,7 @@
@endif
{!! $shipping_address !!}
diff --git a/tests/Unit/PdfHtmlSanitizerTest.php b/tests/Unit/PdfHtmlSanitizerTest.php
index c28ed3af..d94120f4 100644
--- a/tests/Unit/PdfHtmlSanitizerTest.php
+++ b/tests/Unit/PdfHtmlSanitizerTest.php
@@ -25,3 +25,12 @@ it('strips style and link attributes that may carry URLs', function () {
it('returns empty string for empty input', function () {
expect(PdfHtmlSanitizer::sanitize(''))->toBe('');
});
+
+it('normalizes legacy closing-br markup so lines are not collapsed in PDF output', function () {
+ $html = 'line1line2';
+
+ $out = PdfHtmlSanitizer::sanitize($html);
+
+ expect($out)->toContain('
toContain('line1')->toContain('line2');
+ expect($out)->not->toBe('line1line2');
+});