gpt4 book ai didi

python - 使用 Python 对 PDF 文档进行数字签名

转载 作者:行者123 更新时间:2023-11-28 16:33:19 40 4
gpt4 key购买 nike

我正在尝试使用 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说:

In Windows copy the file mypdfsigner.pyd from "C:\Program Files\MyPDFSigner" to C:\Python27\Lib\site-packages.

它还说你需要将安装添加到你的路径中:

To run the example in Windows add "C:\Program Files\MyPDFSigner" to the environment PATH variable

此外,您必须先配置它:

Before using any of the extensions it is necessary to start with the graphical application to create a configuration file for the key store and alias one wants to use. The application creates a .mypdfsigner file in your home directory.

关于python - 使用 Python 对 PDF 文档进行数字签名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29629410/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com