如何在Ruby中对PDF文档进行数字签名?

时间:2011-10-27 15:54:15

标签: ruby

是否有本地库对PDF文档进行数字签名?

2 个答案:

答案 0 :(得分:6)

here似乎提供了使用Ruby签名PDF的扩展。它不是免费的,但看起来它提供了原生的ruby界面。

以下是在ruby中使用if的方法(安装后):

require 'mypdfsigner'
include MyPDFSigner

inputPath = "/tmp/input.pdf"
outputPath = "/tmp/output.pdf"
location = "Chicago"
reason = "Demo"
contactInfo = "+1 555-555-5555"
certify = false   # not supported yet
visible = true
title = "Signing with MyPDFSigner"
author = "KryptoKoder"
subject = "Ruby Extension"
keywords = "PKCS#12, MyPDFSigner, PDF"
confFile = ""   # defaults to /usr/local/mypdfsigner/mypdfsigner.conf if empty
timestamp = true

puts mypdfsigner_sign(inputPath, outputPath, location, reason, contactInfo, certify, visible, title, author, subject, keywords, confFile, timestamp)

还有一个命令行界面,因此您可以根据需要编写脚本,以及桌面应用程序。

答案 1 :(得分:1)

我想要一个iText,因为它可以构建PDF并签名...