hot4devs/document-signer
最新稳定版本:1.1.7
Composer 安装命令:
composer require hot4devs/document-signer
包简介
Add Signature to PDF Documents (https://gitlab.com/hot4devs/document-signer)
README 文档
README
DOCUMENT-SIGNER
Add signature to your documents
FEATURES
- Add crt, key signature to PDF documents
- Sign PDF documents using FPDI adapter
- Returns SignedDocument
- Store document signed on disk
- SignedDocument can be returned as base64
- SignedDocument can be returned as string
USAGE
For PDF Documents
- Using factory (password needed; assume you have the crt and key files on same folder)
In this example use the following folder '/var/cert/valid':
// $name is the name of the crt and key file
$signedDocument = FpdiSigner::sign(
setup: SignerSetting::setup(
certPath: __DIR__ . '/var/cert',
name: 'h4d',
keyPassword: 'somepassowrd',
documentPath: __DIR__ . '/var/document/example.pdf',
)
);
- Get SignedDocument AS base64
// as base64 $base64 = $signedDocument->toBase64();
- Get SignedDocument AS File
If first parameter ($path) is null, the file will be stored in the same folder of the original document
// to file // usign DestinationFolder
use Hot4devs\DocumentSigner\Document\DestinationFolder
$destinationFolder = DestinationFolder::create('/var/destinationPath'); $signedDocument->toFile(destination:$destinationFolder) ->fullPath(); // returns the full path of the file
- Get SignedDocument AS string
// as string $string = $signedDocument->content();
**FULLCODE EXAMPLE**
use Hot4devs\DocumentSigner\Document\Contract\SignedDocument; use Hot4devs\DocumentSigner\Signer\Fpdi\FpdiSigner; use Hot4devs\DocumentSigner\Signer\SignerSetting;
$signedDocument = FpdiSigner::sign(
setup: SignerSetting::setup(
certPath: __DIR__ . '/var/cert',
name: 'h4d',
keyPassword: 'somepassowrd',
documentPath: __DIR__ . '/var/document/example.pdf',
)
);
// save on same folder $signedDocument->toFile();
// returns /var/document/example_signed.pdf $fullPath = $signedDocument->fullPath();
**LIMITATIONS**
- Only works with PDF documents
- Only works with crt and key files
- Not add any image or mark
统计信息
- 总下载量: 84
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-26