Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
composer.lock
vendor
.phpunit.result.cache
vendor
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,58 @@ This package is only wrapper of [JSignPdf](http://jsignpdf.sourceforge.net/) to

### Installation:

```sh
```bash
$ composer require jeidison/jsignpdf-php
```

### Warning
This package use JAVA for sign PDFs

Examples:

```php
use Jeidison\JSignPDF\JSignPDF;
use Jeidison\JSignPDF\Sign\JSignParam;

$param = JSignParam::instance();
$param->setCertificate(file_get_contents('/path/to/file/certificate.pfx'));
$param->setPdf(file_get_contents('/path/to/file/pdf_to_sign.pdf'));
$param->setPassword('certificate_password');

try {
$jSignPdf = new JSignPDF();
$jSignPdf->setCertificate(file_get_contents('caminho_do_seu_certificado_aqui.pfx'));
$jSignPdf->setPassword('senha_do_seu_certificado_aqui');
$jSignPdf->setPdf(file_get_contents('caminho_do_pdf_que_voce_quer_assinar.pdf'));
$fileSigned = $jSignPdf->sign()->output();
file_put_contents('caminho_onde_voce_quer_salvar_aqui.pdf', $fileSigned);
} catch (Exception $e) {
var_dump($e);
}
$jSignPdf = new JSignPDF($param);
$fileSigned = $jSignPdf->sign();
file_put_contents('/path/to/file/file_signed.pdf', $fileSigned);
```

### Without composer:
With Java Installed:
```php

- Download Repository
- Unzip file
...

```php
<?php
$param->setIsUseJavaInstalled(true);

require_once "path/to/JSignPDF.php";
...
```

use Jeidison\JSignPDF\JSignPDF;
File signed as base64:
```php
...
$param->setIsOutputTypeBase64(true);
...
$fileSignedAsBase64 = $jSignPdf->sign();
file_put_contents('/path/to/file/file_signed.pdf', base64_decode($fileSignedAsBase64));
```

Change temp directory:
```php
...
$param->setTempPath('/path/temp/to/sign/files/');
...
```

try {
$jSignPdf = new JSignPDF();
$jSignPdf->setCertificate(file_get_contents('caminho_do_seu_certificado_aqui.pfx'));
$jSignPdf->setPassword('senha_do_seu_certificado_aqui');
$jSignPdf->setPdf(file_get_contents('caminho_do_pdf_que_voce_quer_assinar.pdf'));
$fileSigned = $jSignPdf->sign()->output();
file_put_contents('caminho_onde_voce_quer_salvar_aqui.pdf', $fileSigned);
} catch (Exception $e) {
var_dump($e);
}
Change parameters of JSignPDF:
```php
...
$param->setJSignParameters("-a -kst PKCS12 -ts https://freetsa.org/tsr");
...
```

## Credits
- [Jeidison Farias](https://github.com/jeidison)
69 changes: 69 additions & 0 deletions bin/jre1.8.0_241_linux/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Copyright � 1993, 2020, Oracle and/or its affiliates.
All rights reserved.

This software and related documentation are provided under a
license agreement containing restrictions on use and
disclosure and are protected by intellectual property laws.
Except as expressly permitted in your license agreement or
allowed by law, you may not use, copy, reproduce, translate,
broadcast, modify, license, transmit, distribute, exhibit,
perform, publish, or display any part, in any form, or by
any means. Reverse engineering, disassembly, or
decompilation of this software, unless required by law for
interoperability, is prohibited.

The information contained herein is subject to change
without notice and is not warranted to be error-free. If you
find any errors, please report them to us in writing.

If this is software or related documentation that is
delivered to the U.S. Government or anyone licensing it on
behalf of the U.S. Government, the following notice is
applicable:

U.S. GOVERNMENT END USERS: Oracle programs, including any
operating system, integrated software, any programs
installed on the hardware, and/or documentation, delivered
to U.S. Government end users are "commercial computer
software" pursuant to the applicable Federal Acquisition
Regulation and agency-specific supplemental regulations. As
such, use, duplication, disclosure, modification, and
adaptation of the programs, including any operating system,
integrated software, any programs installed on the hardware,
and/or documentation, shall be subject to license terms and
license restrictions applicable to the programs. No other
rights are granted to the U.S. Government.

This software or hardware is developed for general use in a
variety of information management applications. It is not
developed or intended for use in any inherently dangerous
applications, including applications that may create a risk
of personal injury. If you use this software or hardware in
dangerous applications, then you shall be responsible to
take all appropriate fail-safe, backup, redundancy, and
other measures to ensure its safe use. Oracle Corporation
and its affiliates disclaim any liability for any damages
caused by use of this software or hardware in dangerous
applications.

Oracle and Java are registered trademarks of Oracle and/or
its affiliates. Other names may be trademarks of their
respective owners.

Intel and Intel Xeon are trademarks or registered trademarks
of Intel Corporation. All SPARC trademarks are used under
license and are trademarks or registered trademarks of SPARC
International, Inc. AMD, Opteron, the AMD logo, and the AMD
Opteron logo are trademarks or registered trademarks of
Advanced Micro Devices. UNIX is a registered trademark of
The Open Group.

This software or hardware and documentation may provide
access to or information on content, products, and services
from third parties. Oracle Corporation and its affiliates
are not responsible for and expressly disclaim all
warranties of any kind with respect to third-party content,
products, and services. Oracle Corporation and its
affiliates will not be responsible for any loss, costs, or
damages incurred due to your access to or use of third-party
content, products, or services.
1 change: 1 addition & 0 deletions bin/jre1.8.0_241_linux/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please refer to https://java.com/otnlicense
1 change: 1 addition & 0 deletions bin/jre1.8.0_241_linux/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Please refer to http://java.com/licensereadme
Loading