|
终于找到在Linux下加密PDF文档的方法,共享出来给大家,如有不妥,请各位提出意见和建议。
先在sourceforge.net上下载Multivalent20040415.jar,这是个java程序,在使用这个程序以前先确定自己安装了java,找不到的同学我通过mail发给你。
下载以后可以直接运行,比如我要加密一个叫1.pdf的文档,使用如下命令:
[code:1]
java -classpath /root/Multivalent20040415.jar tool.pdf.Encrypt -owner 123456 -user 111111 -restrict pPcCmtfa 1.pdf
[/code:1]
生成的新文件叫1-y.pdf,奇怪的命名方式。
使用心得:一开始我只使用-user设置密码,发现做的所有限制都不起作用,在他们网站上问过以后才发现要使用限制的话必须使用-owner参数设置密码,这样在打开文件时如果不使用-owner指定的参数,那么所有的限制都会有效。这一点很重要。我不懂java,这个运行方式是从网站上看来的。
选项的说明(从网站上复制过来):
[code:1]
Options
java tool.pdf.Encrypt [options] PDF-files-or-directories
* -password password -- directly re-encrypt a PDF by supplying the existing owner password
* -user password -- set user password. In the absence of a user password, the null password is used, which lets one set restrictions without requiring a password to view the document.
* -owner password -- set owner password.
* -restrict[ions] actions -- (see below)
* -perm[missions] actions -- -restrict and -perm set the operations available on the encrypted document. If -perm is given, then all actions are restricted except those so permitted. If -restrict is given, then all actions are permitted except those so restricted. If neither option is given, all operations are permitted. Actions are expressed as one or more letters from the following list:
o p - print high-quality
o P - print
o c - copy or otherwise extract text and graphics
o C - copy or otherwise extract text even for disabled users
o m - modify the contents, such as creating form fields and signatures
o t - annotate
o f - fill in forms
o a - assemble the document (insert, rotate, delete pages, create bookmarks or thumbnail images)
o or all as a synonym for pPcCmtfa
* -compat[ible] -- rather than 128-bit encryption, use only 40-bit encryption in order to be compatible with older PDF viewers (Acrobat 5 and later support 128-bit encryption). This is not recommended because 40-bit keys are easily cracked.
* -inplace -- write encrypted PDF over existing
In the absence of -inplace, the encrypted version of the PDF is named with -y appended to the original file name.
[/code:1]
我还想找windows下加密pdf文档的软件,没找到好用的,总是需要注册,不知道哪位同学有可以自由使用的?谢谢! |
|