如何通过批处理将密码放入PDF中

时间:2012-02-27 04:03:07

标签: vb.net pdf

是否有可以在PDF中输入密码的工具或DLL?

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

-Regards, RYL

2 个答案:

答案 0 :(得分:0)

使用Gnostice PDFOne .NET可以做到这一点。

请仔细阅读下面给出的文章链接。 http://www.gnostice.com/goto.asp?id=28504&t=encrypt_documents_using_gnostice_pdfone_.net

免责声明:我为Gnostice工作。

答案 1 :(得分: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文件。

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