kampak/libsignpdf
Composer 安装命令:
composer require kampak/libsignpdf
包简介
This is a library for pdf signing
README 文档
README
What is LibSignPDF?
LibSignPDF is a library to create signature annotation on PDF.
LibSignPDF provides a signature annotation for invisible signature and visible signature. This library also support PAdES signature and multiple signature. This library not provide CMS. The CMS havee to provide in another system.
Requirements
To build LibSignPDF lib you'll need:
- qpdf
Development quickstart
LibSignPDF can be used on various operating systems because it is compiled into binary code that can be executed directly by the machine. LibSignPDF is created using the rust programming language which is then compiled into a shared library.
Warning: LibSignPDF is known to be working in cross-compilation toolchains (eg. MacOS/Linux/Windows) but in usage still need qpdf package because the qpdf is not static linking when it compiled.
Install package
From the composer project run:
composer require kampak/libsignpdf
Example usage
This is an example code to use LibSignPDF library
use Kampak\LibSignPDF\SignPDF;
// This is the parameters that you need for generating CMS
$options = [
'email' => "test@libsignpdf.com",
'password' => "P@ssw0rd"
];
function signDigestFunction($digest, $options = []) {
// START YOUR CODE
// Please insert your code to get cms by sign the digest
$yourCMS = "get_your_cms_from_your_server_by_sign_the_digest";
// END YOUR CODE
$buffer = FFI::new("char[" . (strlen($yourCMS) + 1) . "]", false);
FFI::memcpy($buffer, $yourCMS, strlen($yourCMS));
$buffer[strlen($yourCMS)] = "\0";
$response = FFI::new("char *", false);
$response = FFI::addr($buffer[0]);
return $response;
}
// Create an instance of PDFSigner
$signer = new SignPDF("signDigestFunction", $options);
// Sign the PDF
$inputFile = "your_input_pdf_path";
$outputFile = "your_output_pdf_path";
$visualizationFile = "your_image_visualization_path";
$signer->signPDF(
$inputFile, // input file
$outputFile, // output file
$visualizationFile, // visualization file
"https://example.com", // url for QRCode
1, // page will be place the signature
1, // isPades signature
0, // type od signature (0 for invisible, 1 for visible image)
100.0, // x position on pdf for place visualization of signature (start on bottom left)
200.0, // y position on pdf for place visualization of signature (start on bottom left)
300.0, // width of visualization for place signature (start on bottom left)
400.0 // height of visualization for place signature (start on bottom left)
);
Authors
Warning: Please don't use personal email addresses for technical support inquries, but create github issues instead.
LibSignPDF is currently developed and maintained by LibSignPDF, together with LibSignPDF and others. See the file
kampak/libsignpdf 适用场景与选型建议
kampak/libsignpdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 kampak/libsignpdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kampak/libsignpdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-24