Acrobat javascript: DeletePages Error "This Operation Is Not Allowed"

Asked 2 years ago, Updated 2 years ago, 115 views

Operating System: Windows 7 SP1 Acrobat:Acrobat Reader XI

Currently, we are trying to accomplish the process of deleting PDF pages with PDF embedded javascript.
For this reason, we are referring to the Delete Designated Page page of Adobe Acrobat XI+JavaScript Example Dictionary.

However, the sample (sample.pdf) on the above page is not working well.
(Press the button to delete the second page, but not to delete it)
I checked the JavaScript debugger that came with Acrobat Reader and found the following error:
○ Runtime Error

RaiseError: This operation is not allowed Doc.deletePages:1:Field button:Mouse Up===>
This operation is not allowed

Similarly, when I ran the following code on the JavaScript debugger that came with Acrobat Reader, I received the same error.
○ Running Script

this.deletePages(1);

○Error

RaiseError: This operation is not allowed Doc.deletePages:1:Console undefined:Exec
===>This operation is not allowed

How can I avoid the above errors?
As it appeared to be a security issue, we tried to change the settings as follows, but the situation did not change.
○ Modified settings
■Settings>Javascript
·Enable JavaScript execution permission for menu items Off→On
·Enable global object security policy ON→OFF
■Settings>Security
·No changes
■Settings>Security (Enhanced)
·Enable Enhanced Security On→Off

Thank you for your advice.

javascript pdf

2022-09-30 19:44

1 Answers

deletePages() has the following in reference (italics are original mama):

Beginning with version 6.0, this method deletes spawned pages from within Adobe Reader for documents with forms usage rights enabled.

If you try defining a page template on Acrobat and place a button that runs this.getTemplate('hoge'), the page created by pressing this button on Acrobat or Adobe Reader will be deletePages() was able to delete it.However, I still couldn't delete the normal page.

Considering that it matches the reference description, it seems difficult to avoid.


2022-09-30 19:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.