Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adobe Acrobat DC Javascript "not a function"

New Here ,
Mar 15, 2020 Mar 15, 2020

Hello,

 

I'm trying to deletePags and I believe I followed the API reference correctly. I have a script in the Javascripts folder of Acrobat. On launch, I get this syntax error: this.deletePages is not a function.

 

For refrence, this.deletePages(2, 4); is what I am trying to use.

I will also note, that this.insertPages does not throw any error. I believe 'this', is a Doc object according to the api refrence guide.

 

If I open a document and manually do the deletePages from the console, it does work. For some reason it is just a parsing error on Acrobat startup. But, because of this the scripts are not available for user to use on PDFs.

 

Any assitance is greatly appreciated.

1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 15, 2020 Mar 15, 2020

If you try to put this.deletePages(2,4) in your startup scripts, just that by itself, it CANNOT work. No files are open when the startup scripts are read. You are not the first to assume (if this is what you are assuming) that you can create a script, put it in the startup folder, and double click on a file to run the script on the file. No, nothing like that can work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2020 Mar 15, 2020

Every user with Acrobat Standard or Pro can use the console.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 15, 2020 Mar 15, 2020
LATEST

Sounds like you want to automate removing pages from a PDF? 

Do do this you can write an automation (folder level) script that sets up a menu item or button for it. 

Or just run the code from the console window.

See these links for more information (watch the video in the first one):

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

https://acrobatusers.com/tutorials/add_custom_menu_items/

https://acrobatusers.com/tutorials/folder_level_scripts/

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines