Мне нужно установить права пользователя в pdf документе (редактировать, распечатать и т. Д.). Я прочитал «Справочник по сценариям Acrobat JavaScript» и «Разработка приложений Acrobat® с использованием JavaScript», но не нашел ни одного кода, работающего без сертификата.
Я видел, что другие программы, такие как FoxIt или PDFCreator, используют простую функцию для применения пароля и установки прав пользователя без сертификата. Даже у Acrobat есть такие опции в его интерфейсе, например, в vba с PDFCreator:
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
Как сделать то же самое с кодом Javascript в документе PDF?