From 89f5231649c9ae1a76dc513d985d023f9c29ae85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 25 Jun 2024 13:25:49 +0200 Subject: [PATCH] Refactor PDFSignatureZoneParser to use float values This update changes how we handle values in PDFSignatureZoneParser class. Specifically, we've modified the 'MediaBox' and 'PDFSignatureZone' variables to use float values. The helps ensure greater precision, minimize errors, and maintain data consistency across the application. --- .../Service/Signature/PDFSignatureZoneParser.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillDocStoreBundle/Service/Signature/PDFSignatureZoneParser.php b/src/Bundle/ChillDocStoreBundle/Service/Signature/PDFSignatureZoneParser.php index 3aade2fcc..d57b98abf 100644 --- a/src/Bundle/ChillDocStoreBundle/Service/Signature/PDFSignatureZoneParser.php +++ b/src/Bundle/ChillDocStoreBundle/Service/Signature/PDFSignatureZoneParser.php @@ -39,15 +39,16 @@ class PDFSignatureZoneParser $defaultPageDetails = $defaultPage->getDetails(); foreach ($pdf->getPages() as $index => $page) { + $details = $page->getDetails(); $pdfPage = new PDFPage( $index, - $page['MediaBox'][2] ?? $defaultPageDetails['MediaBox'][2], - $page['MediaBox'][3] ?? $defaultPageDetails['MediaBox'][3], + (float) ($details['MediaBox'][2] ?? $defaultPageDetails['MediaBox'][2]), + (float) ($details['MediaBox'][3] ?? $defaultPageDetails['MediaBox'][3]), ); foreach ($page->getDataTm() as $dataTm) { if (str_starts_with($dataTm[1], self::ZONE_SIGNATURE_START)) { - $zones[] = new PDFSignatureZone($dataTm[0][4], $dataTm[0][5], $this->defaultHeight, $this->defaultWidth, $pdfPage); + $zones[] = new PDFSignatureZone((float) $dataTm[0][4], (float) $dataTm[0][5], $this->defaultHeight, $this->defaultWidth, $pdfPage); } } }