From fa93c4a0a1e2cd84a354883f101979b2c50083f8 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Fri, 6 Nov 2020 12:39:26 +0100 Subject: [PATCH 1/3] Fix duplicated offset of lines in TcPdfOutput --- src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php index 2121bb08..3124f174 100644 --- a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php +++ b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php @@ -231,8 +231,8 @@ private function addSeparatorContentIfNotPrintable(): void { if (!$this->isPrintable()) { $this->tcPdf->SetLineStyle(array('width' => 0.1, 'color' => array(0, 0, 0))); - $this->printLine(2 + $this->offsetX, 193 + $this->offsetY, 208 + $this->offsetX, 193 + $this->offsetY); - $this->printLine(62 + $this->offsetX, 193 + $this->offsetY, 62 + $this->offsetX, 296 + $this->offsetY); + $this->printLine(2, 193, 208, 193); + $this->printLine(62, 193, 62, 296); $this->tcPdf->SetFont(self::FONT, '', self::FONT_SIZE_FURTHER_INFORMATION); $this->SetY(188); $this->SetX(5); From fcf3b5111336cf695adc10ac33474217df921584 Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Fri, 6 Nov 2020 12:40:18 +0100 Subject: [PATCH 2/3] Allow offset of pdfs to be a float instead of an int --- src/PaymentPart/Output/FpdfOutput/FpdfOutput.php | 8 ++++---- src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php b/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php index 837a0e12..51b8b386 100644 --- a/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php +++ b/src/PaymentPart/Output/FpdfOutput/FpdfOutput.php @@ -51,18 +51,18 @@ final class FpdfOutput extends AbstractOutput implements OutputInterface /** @var float */ private $amountLS = 0; - /* @var int */ + /* @var float */ private $offsetX; - /* @var int */ + /* @var float */ private $offsetY; public function __construct( QrBill $qrBill, string $language, Fpdf $fpdf, - int $offsetX = 0, - int $offsetY = 0 + float $offsetX = 0, + float $offsetY = 0 ) { parent::__construct($qrBill, $language); $this->fpdf = $fpdf; diff --git a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php index 3124f174..a8fa1123 100644 --- a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php +++ b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php @@ -58,18 +58,18 @@ final class TcPdfOutput extends AbstractOutput implements OutputInterface /* @var TCPDF */ private $tcPdf; - /* @var int */ + /* @var float */ private $offsetX; - /* @var int */ + /* @var float */ private $offsetY; public function __construct( QrBill $qrBill, string $language, TCPDF $tcPdf, - int $offsetX = 0, - int $offsetY = 0 + float $offsetX = 0, + float $offsetY = 0 ) { parent::__construct($qrBill, $language); $this->tcPdf = $tcPdf; @@ -347,7 +347,7 @@ private function printMultiCell( $this->tcPdf->MultiCell($w, $h, $text, self::BORDER, $textAlign, false, $nextLineAlign); } - private function printLine(int $x1, int $y1, int $x2, int $y2) : void + private function printLine(float $x1, float $y1, float $x2, float $y2) : void { $this->tcPdf->Line($x1+$this->offsetX, $y1+$this->offsetY, $x2+$this->offsetX, $y2+$this->offsetY); } From 67c5e0a89ce086458a12fa0cc97b385409fb31fd Mon Sep 17 00:00:00 2001 From: Manuel Reinhard Date: Sun, 8 Nov 2020 14:08:43 +0100 Subject: [PATCH 3/3] Fix parameter type hints of internal method --- src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php index a8fa1123..d99c479f 100644 --- a/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php +++ b/src/PaymentPart/Output/TcPdfOutput/TcPdfOutput.php @@ -347,7 +347,7 @@ private function printMultiCell( $this->tcPdf->MultiCell($w, $h, $text, self::BORDER, $textAlign, false, $nextLineAlign); } - private function printLine(float $x1, float $y1, float $x2, float $y2) : void + private function printLine(int $x1, int $y1, int $x2, int $y2) : void { $this->tcPdf->Line($x1+$this->offsetX, $y1+$this->offsetY, $x2+$this->offsetX, $y2+$this->offsetY); }