2012-02-27 41 views
4

有没有可以在PDF中输入密码的工具或DLL?如何通过批量输入PDF密码

示例我有1,000个PDF文件我想在每个PDF上输入密码?每个文件的密码都不相同。

-Regards, RYL

+0

我使用PDF实验室PDFTK – user870510 2012-02-27 06:47:07

回答

0

Docotic.Pdf library可以用来保护带有密码的PDF文件。

这里是你的任务的示例代码:

Dim filesToProcess As String() 
' populate filesToProcess somehow 

For Each fileName As String In filesToProcess 
    Using pdf As New PdfDocument(fileName) 
     ' use OwnerPassword property if you need to protect file from being modified 
     ' use UserPassword property if you need to protect file from being modified and from being viewed without knowing the password 
     pdf.UserPassword = "password" 

     ' there is also another supported encryption algorithms 
     pdf.Encryption = PdfEncryptionAlgorithm.Aes128Bit 

     Dim savePath As String = fileName & "encrypted.pdf" 
     pdf.Save(savePath) 
    End Using 
Next 

您还可以setup permissions任何保护的PDF文件。

声明:我为图书馆的供应商工作。