2015-04-14 120 views
3

我想用Python签署PDF文档,并找到一些名为MyPDFSigner的东西。用Python数字签名PDF文档

这是有据可查的,但我发现文件有点混淆。 我遇到的唯一问题是如何安装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) 

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

谢谢。

回答

1

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.

+0

你是对的,谢谢。我错过了,我的坏。但是,这样做后,运行test.py它会给我一个错误:Traceback(最近调用最后一次): 文件“C:\ Program Files文件(x86)\ MyPDFSigner \ tests \ test.py”,第3行 import mypdfsigner ImportError:DLL load failer:无法找到指定的模块。 你认为它与某些DLL有关吗? –

+0

更新时参考了文档 –

+1

非常感谢。有效。猜猜我现在必须更多地关注文档。 –

相关问题