Acrobat:使用密码保护功能在pdf文档中设置用户权限

时间:2018-10-27 16:30:11

标签: javascript acrobat-sdk

我需要在pdf文档(编辑,打印等)中设置权限用户。我阅读了“ Acrobat JavaScript脚本参考”和“使用JavaScript开发Acrobat®应用程序”,但是没有找到没有证书运行的代码。

我看到其他程序,例如FoxIt或PDFCreator,使用了一个简单的功能来应用密码并设置没有证书的权限用户。甚至,Acrobat的界面中也有此选项,例如在带有PDFCreator的vba中:

Set pdfjob = PDFCreatorQueue.NextJob

With pdfjob
    .SetProfileByGuid ("DefaultGuid")

    ' Set up the pdf security using the SetProfileSetting method of the job object.
    '-------------------------------------------------------------------------------
    'Since we want to make our pdf more safe, we have to enable the security action first
    .SetProfileSetting "PdfSettings.Security.Enabled", "true"
    ' We set up the encryption level to medium
    .SetProfileSetting "PdfSettings.Security.EncryptionLevel", "Rc128Bit"
    ' Notice that in order to have a user password we have also to set the owner password
    ' and additionally enable the RequireUserPassword property
    .SetProfileSetting "PdfSettings.Security.OwnerPassword", sOwnerPassword
    ' Require a user password to be able to view the PDF
    .SetProfileSetting "PdfSettings.Security.RequireUserPassword", "true"
    ' Now everyone who wants to open the converted file has to know the security password "myPassword"
    .SetProfileSetting "PdfSettings.Security.UserPassword", sUserPassword
    ' Set Security options
    .SetProfileSetting "PdfSettings.Security.AllowToCopyContent", IIf(bAllowCopy, "True", "False")
    .SetProfileSetting "PdfSettings.Security.AllowPrinting", IIf(bAllowPrint, "True", "False")
    .SetProfileSetting "PdfSettings.Security.AllowToEditTheDocument", IIf(bAllowEdit, "True", "False")


    ' Setup main option
    '-------------------------------------------------------------------------------
    .SetProfileSetting "OpenViewer", IIf(bOpenViewer, "True", "False")


End With

如何使用PDF文档中的 JavaScript代码做同样的事情?

0 个答案:

没有答案