@adamhudsonnall/pdf-signer 中文文档教程
PDF signer
node.js 的 JavaScript PDF 签名器。
Installation
安装使用 npm 包管理器。 安装 npm 后只需键入以下命令。
npm install pdf-signer
Usage
单一签名示例:
import { sign } from 'pdf-signer'
const p12Buffer = fs.readFileSync(`./assets/pdf-signer.p12`)
const pdfBuffer = fs.readFileSync(`./assets/example.pdf`)
const signedPdf = sign(pdfBuffer, p12Buffer, 'pdfsigner', {
reason: '2',
email: 'test@email.com',
location: 'Location, LO',
signerName: 'Test User',
annotationAppearanceOptions: {
signatureCoordinates: { left: 0, bottom: 700, right: 190, top: 860 },
signatureDetails: [
{
value: 'Signed by: Kiss Béla',
fontSize: 7,
transformOptions: { rotate: 0, space: 1, tilt: 0, xPos: 20, yPos: 20 },
},
{
value: 'Date: 2019-10-11',
fontSize: 7,
transformOptions: { rotate: 0, space: 1, tilt: 0, xPos: 20, yPos: 30 },
},
],
},
})
fs.writeFileSync('./assets/results/signed.pdf', signedPdf)
更多示例可以在规范文件规范中找到。
Contributing
欢迎请求请求。 对于重大更改,请先打开一个问题来讨论您想要更改的内容。
请确保适当地更新测试。
License
PDF signer
A JavaScript PDF signer for node.
This package is based on vbuch work: node-signpdf.
Installation
Installation uses the npm package manager. Just type the following command after installing npm.
npm install pdf-signer
Usage
single signing example:
import { sign } from 'pdf-signer'
const p12Buffer = fs.readFileSync(`./assets/pdf-signer.p12`)
const pdfBuffer = fs.readFileSync(`./assets/example.pdf`)
const signedPdf = sign(pdfBuffer, p12Buffer, 'pdfsigner', {
reason: '2',
email: 'test@email.com',
location: 'Location, LO',
signerName: 'Test User',
annotationAppearanceOptions: {
signatureCoordinates: { left: 0, bottom: 700, right: 190, top: 860 },
signatureDetails: [
{
value: 'Signed by: Kiss Béla',
fontSize: 7,
transformOptions: { rotate: 0, space: 1, tilt: 0, xPos: 20, yPos: 20 },
},
{
value: 'Date: 2019-10-11',
fontSize: 7,
transformOptions: { rotate: 0, space: 1, tilt: 0, xPos: 20, yPos: 30 },
},
],
},
})
fs.writeFileSync('./assets/results/signed.pdf', signedPdf)
More examples can be found in spec file spec.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.