Update for page numbering

This commit is contained in:
David Bomba 2025-08-29 09:51:12 +10:00
parent 8b46b6737e
commit 6f231fbd60
3 changed files with 12 additions and 14 deletions

View File

@ -36,23 +36,21 @@ class PDF extends FPDI
// Calculate X position with offset
$base_x = config('ninja.pdf_page_numbering_x_alignment');
$x_position = $base_x + $this->x_offset;
// Set X position based on alignment
if ($this->text_alignment == 'L') {
$this->SetX($x_position);
$this->SetX($this->GetX() + $base_x);
// Adjust cell width to account for X offset
$cell_width = $this->GetPageWidth() - $x_position - 10;
$cell_width = $this->GetPageWidth();
$this->Cell($cell_width, 5, $trans, 0, 0, 'L');
} elseif ($this->text_alignment == 'R') {
$this->SetX($x_position);
$this->SetX($this->GetX() + $base_x);
// For right alignment, calculate width from X position to right edge
$cell_width = $this->GetPageWidth() - $x_position;
$cell_width = $this->GetPageWidth();
$this->Cell($cell_width, 5, $trans, 0, 0, 'R');
} else {
$this->SetX($x_position);
// For center alignment, calculate appropriate width
$cell_width = $this->GetPageWidth() - ($x_position * 2);
$cell_width = $this->GetPageWidth();
$this->Cell($cell_width, 5, $trans, 0, 0, 'C');
}
}

12
composer.lock generated
View File

@ -11410,16 +11410,16 @@
},
{
"name": "sentry/sentry",
"version": "4.15.0",
"version": "4.15.1",
"source": {
"type": "git",
"url": "https://github.com/getsentry/sentry-php.git",
"reference": "b2d84de69f3eda8ca22b0b00e9f923be3b837355"
"reference": "0d09baf3700869ec4b723c95eb466de56c3d74b6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/b2d84de69f3eda8ca22b0b00e9f923be3b837355",
"reference": "b2d84de69f3eda8ca22b0b00e9f923be3b837355",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/0d09baf3700869ec4b723c95eb466de56c3d74b6",
"reference": "0d09baf3700869ec4b723c95eb466de56c3d74b6",
"shasum": ""
},
"require": {
@ -11483,7 +11483,7 @@
],
"support": {
"issues": "https://github.com/getsentry/sentry-php/issues",
"source": "https://github.com/getsentry/sentry-php/tree/4.15.0"
"source": "https://github.com/getsentry/sentry-php/tree/4.15.1"
},
"funding": [
{
@ -11495,7 +11495,7 @@
"type": "custom"
}
],
"time": "2025-08-20T14:26:37+00:00"
"time": "2025-08-28T15:45:14+00:00"
},
{
"name": "sentry/sentry-laravel",

View File

@ -257,7 +257,7 @@ return [
'storecove_email_catchall' => env('STORECOVE_CATCHALL_EMAIL',false),
'qvalia_api_key' => env('QVALIA_API_KEY', false),
'qvalia_partner_number' => env('QVALIA_PARTNER_NUMBER', false),
'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', 0),
'pdf_page_numbering_x_alignment' => env('PDF_PAGE_NUMBER_X', -10),
'pdf_page_numbering_y_alignment' => env('PDF_PAGE_NUMBER_Y', -6),
'hosted_einvoice_secret' => env('HOSTED_EINVOICE_SECRET', null),
'e_invoice_quota_warning' => env('E_INVOICE_QUOTA_WARNING', 15),