我试图用Python签署PDF文档,发现了一个名为MyPDFSigner的东西。
它有很好的文档,但是我发现文档有点混乱。
我遇到的唯一问题是如何安装mypdfsigner模块来运行签署文档的代码。
文档本身提供了一个代码示例,但在未安装模块的情况下,我将无法运行它:

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

print mypdfsigner.sign(inputPath, outputPath, location, reason, contactInfo, certify, visible, title, author, subject, keywords, confFile, timestamp)

有没有人已经试过这个工具,并有什么建议给我?或者如果你知道其他任何签署PDF文件的Python库,请告诉我。
谢谢。

最佳答案

documentation表示:
在Windows中,将文件mypdfsigner.pyd"C:\Program Files\MyPDFSigner"复制到C:\Python27\Lib\site-packages.
它还说您需要将安装添加到您的路径:
若要在Windows中运行此示例,请将“C:\ Program Files\MyPDFSigner”添加到环境路径变量
此外,必须先配置它:
在使用任何扩展之前,必须从图形应用程序开始,为要使用的密钥存储和别名创建配置文件。应用程序在主目录中创建一个.mypdfsigner文件。

09-30 00:29