Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/fix implement signature image process #85

Merged
merged 3 commits into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@
<td>Package version</td>
<td>Docs</td>
</tr>

<tr>
<td>^8~8.54</td>
<td rowspan="2">^7.4</td>
<td>^0~0.0.11</td>
<td rowspan="2"><a href="https://laravel-a1-pdf-sign.netlify.app/docs/0.x/home">Official Doc</a></td>
</tr>

<tr>
<td>^8.56+</td>
<td>^0.0.12</td>
</tr>

<tr>
<td>^9</td>
<td rowspan="2">^8.1 or ^8.2</td>
Expand All @@ -56,7 +56,7 @@
<tr>
<td>^10</td>
</tr>

</table>


Expand All @@ -71,6 +71,6 @@
<h1 align="center">Do you want to support this project?</h1>
<p align="center">
<a href="https://www.buymeacoffee.com/lucasnepomuceno" target="_blank">
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 200px !important;" >
<img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" height="60" width="200" >
</a>
</p>
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
},
"suggest": {
"ext-gd": "To use GD library based image processing.",
"ext-imagick": "To use Imagick based image processing."
"ext-imagick": "To use Imagick based image processing.",
"lsnepomuceno/laravel-brazilian-ceps": "A package for querying zip codes for Brazilian addresses."
},
"require-dev": {
"orchestra/testbench": "^8",
Expand Down
6 changes: 4 additions & 2 deletions src/Sign/SignaturePdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ public function signature(): string|BinaryFileResponse
$this->pdf->AddPage($width > $height ? 'L' : 'P', [$width, $height]);
$this->pdf->useTemplate($pageIndex);

if ($this->hasSealImgOnEveryPages) $this->implementSignatureImage((int)$pageIndex);
if ($this->hasSealImgOnEveryPages ||
$i === ($this->image['page'] ?? 0)) {
$this->implementSignatureImage($i);
}
}

$certificate = $this->cert->getCert()->original;
Expand All @@ -196,7 +199,6 @@ public function signature(): string|BinaryFileResponse
'A' // Authorize certificate
);

if (!$this->hasSealImgOnEveryPages) $this->implementSignatureImage();
if (empty($this->fileName)) $this->fileName = Str::orderedUuid();
if ($this->hasSignedSuffix) $this->fileName .= '_signed';

Expand Down