Skip to content

Commit

Permalink
better visual with pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Nov 14, 2024
1 parent 98073e9 commit da02ef0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions config/invoices.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@
* @see Available options https://github.com/barryvdh/laravel-dompdf#configuration
*/
'pdf_options' => [
'isRemoteEnabled' => true,
'isPhpEnabled' => true,
'fontHeightRatio' => 0.9,
],

'paper_options' => [
Expand Down
4 changes: 2 additions & 2 deletions resources/views/default/invoice.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
$tax_number = data_get($invoice->seller, 'tax_number');
$company_number = data_get($invoice->seller, 'company_number');
@endphp
<p><strong>{{ __('invoices::invoice.from') }}</strong></p>
<p class="pb-1"><strong>{{ __('invoices::invoice.from') }}</strong></p>
@if ($name)
<p class="pb-1 text-sm">{{ $name }}</p>
@endif
Expand Down Expand Up @@ -138,7 +138,7 @@
$tax_number = data_get($invoice->buyer, 'tax_number');
$company_number = data_get($invoice->buyer, 'company_number');
@endphp
<p><strong>{{ __('invoices::invoice.to') }}</strong></p>
<p class="pb-1"><strong>{{ __('invoices::invoice.to') }}</strong></p>
@if ($name)
<p class="pb-1 text-sm">{{ $name }}</p>
@endif
Expand Down
3 changes: 2 additions & 1 deletion resources/views/default/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<title>{{ $invoice->name }}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

{{-- <link href="https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap" rel="stylesheet"> --}}
@include('invoices::default.style')
</head>

Expand All @@ -15,7 +16,7 @@
if (isset($pdf)) {
$text = "Page {PAGE_NUM} / {PAGE_COUNT}";
$size = 10;
$font = $fontMetrics->getFont("Helvetica");
$font = $fontMetrics->getFont("DejaVu Sans");
$width = $fontMetrics->get_text_width($text, $font, $size) / 2;
$x = ($pdf->get_width() - $width);
$y = $pdf->get_height() - 35;
Expand Down
14 changes: 7 additions & 7 deletions resources/views/default/style.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
margin: 0;
line-height: 1.5;
tab-size: 4;
font-family: "DejaVu Sans", "Courier", ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-family: 'DejaVu Sans', 'Helvetica', 'Courier', 'Times', 'Symbol', 'ZapfDingbats';
font-feature-settings: normal;
font-variation-settings: normal;
}
Expand Down Expand Up @@ -158,20 +158,20 @@
}
.pb-1 {
padding-bottom: 0.25rem;
padding-bottom: 4px;
}
.pr-1 {
padding-right: 0.25rem;
padding-right: 4px;
}
.p-1 {
padding: 0.25rem;
padding: 4px;
}
.py-1,
.pt-1 {
padding-top: 0.25rem;
padding-top: 4px;
}
.pr-2,
Expand Down Expand Up @@ -205,11 +205,11 @@
}
.mb-1 {
margin-bottom: 0.25rem;
margin-bottom: 4px;
}
.mt-1 {
margin-top: 0.25rem;
margin-top: 4px;
}
.mb-6 {
Expand Down

0 comments on commit da02ef0

Please sign in to comment.