-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# PHP-SIGNER | ||
|
||
Esse é um pacote escrito inteiramente em PHP para assinar PDF's com suporte a multiplas assinaturas. | ||
|
||
## INSTALAÇÃO: | ||
```bash | ||
composer require jeidison/pdf-signer | ||
``` | ||
|
||
## EXEMPLOS: | ||
|
||
Assinando documentos: | ||
```php | ||
$pathFileCertificate = 'path_do_seu_arquivo.pfx'; | ||
$passwordCertificate = 'senha do seu pfx'; | ||
$fileContent = file_get_contents('path_do_seu_certificado.pdf'); | ||
|
||
$fileContentSigned = Signer::new() | ||
->withCertificate($pathFileCertificate, $passwordCertificate) | ||
->withContent($fileContent) | ||
->sign(); | ||
|
||
file_put_contents('path_onde_vc_quer_salvar_o_seu_pdf.pdf', $fileContentSigned); | ||
``` | ||
|
||
Assinando documentos com metadados(Razão, Nome, Local, Informações de contato): | ||
```php | ||
$pathFileCertificate = 'path_do_seu_arquivo.pfx'; | ||
$passwordCertificate = 'senha do seu pfx'; | ||
$fileContent = file_get_contents('path_do_seu_certificado.pdf'); | ||
|
||
$fileContentSigned = Signer::new() | ||
->withCertificate($pathFileCertificate, $passwordCertificate) | ||
->withContent($fileContent) | ||
->withMetadata( | ||
Metadata::new() | ||
->withReason('ASSINATURA DE DOCUMENTOS PARA TESTES.') | ||
->withName('JEIDISON SANTOS FARIAS') | ||
->withLocation('Araras/SP') | ||
->withContactInfo('Jeidison Farias <jeidison[email protected]>') | ||
) | ||
->sign(); | ||
|
||
file_put_contents('path_onde_vc_quer_salvar_o_seu_pdf.pdf', $fileContentSigned); | ||
``` | ||
|
||
Assinando documentos com assinatura visível: | ||
```php | ||
$pathFileCertificate = 'path_do_seu_arquivo.pfx'; | ||
$passwordCertificate = 'senha do seu pfx'; | ||
$fileContent = file_get_contents('path_do_seu_certificado.pdf'); | ||
|
||
$fileContentSigned = Signer::new() | ||
->withCertificate($pathFileCertificate, $passwordCertificate) | ||
->withContent($fileContent) | ||
->withSignatureAppearance( | ||
SignatureAppearance::new() | ||
->withImage('/path_do_seu_icone.png') | ||
->withRect([350, 770, 400, 820]) | ||
) | ||
->sign(); | ||
|
||
file_put_contents('path_onde_vc_quer_salvar_o_seu_pdf.pdf', $fileContentSigned); | ||
``` | ||
|
||
Adicionando carimbo de tempo na assinatura: | ||
```php | ||
// Ainda não implementado. | ||
``` | ||
|
||
## Credits | ||
- [Jeidison Farias](https://github.com/jeidison) | ||
- [All Contributors](../../contributors) |