mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 23:04:58 +00:00
signature: add index on PDFSignatureZone + init POST signature
This commit is contained in:
@@ -16,6 +16,8 @@ use Symfony\Component\Serializer\Annotation\Groups;
|
||||
final readonly class PDFSignatureZone
|
||||
{
|
||||
public function __construct(
|
||||
#[Groups(['read'])]
|
||||
public int $index,
|
||||
#[Groups(['read'])]
|
||||
public float $x,
|
||||
#[Groups(['read'])]
|
||||
@@ -31,7 +33,8 @@ final readonly class PDFSignatureZone
|
||||
public function equals(self $other): bool
|
||||
{
|
||||
return
|
||||
$this->x == $other->x
|
||||
$this->index == $other->index
|
||||
&& $this->x == $other->x
|
||||
&& $this->y == $other->y
|
||||
&& $this->height == $other->height
|
||||
&& $this->width == $other->width
|
||||
|
@@ -37,6 +37,7 @@ class PDFSignatureZoneParser
|
||||
$defaults = $pdf->getObjectsByType('Pages');
|
||||
$defaultPage = reset($defaults);
|
||||
$defaultPageDetails = $defaultPage->getDetails();
|
||||
$zoneIndex = 0;
|
||||
|
||||
foreach ($pdf->getPages() as $index => $page) {
|
||||
$details = $page->getDetails();
|
||||
@@ -48,7 +49,8 @@ class PDFSignatureZoneParser
|
||||
|
||||
foreach ($page->getDataTm() as $dataTm) {
|
||||
if (str_starts_with($dataTm[1], self::ZONE_SIGNATURE_START)) {
|
||||
$zones[] = new PDFSignatureZone((float) $dataTm[0][4], (float) $dataTm[0][5], $this->defaultHeight, $this->defaultWidth, $pdfPage);
|
||||
$zones[] = new PDFSignatureZone((int) $zoneIndex, (float) $dataTm[0][4], (float) $dataTm[0][5], $this->defaultHeight, $this->defaultWidth, $pdfPage);
|
||||
$zoneIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user