PHP code example of jeidison / jsignpdf-php

1. Go to this page and download the library: Download jeidison/jsignpdf-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeidison / jsignpdf-php example snippets


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');

$jSignPdf   = new JSignPDF($param);
$fileSigned = $jSignPdf->sign();
file_put_contents('/path/to/file/file_signed.pdf', $fileSigned);

$param->setIsUseJavaInstalled(true);

$param->setJavaPath('/path/to/bin/java');

$param->setjSignPdfJarPath('/path/to/jsignpdf');

$param->setIsOutputTypeBase64(true);

$param->setTempPath('/path/temp/to/sign/files/');

$param->setJSignParameters("-a -kst PKCS12 -ts https://freetsa.org/tsr");
bash
$ composer