Skip to main content
Participant
March 15, 2020
Question

Adobe Acrobat DC Javascript "not a function"

  • March 15, 2020
  • 3 replies
  • 1597 views

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.

    This topic has been closed for replies.

    3 replies

    Thom Parker
    Community Expert
    Community Expert
    March 15, 2020

    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 PDFScriptingUse the Acrobat JavaScript Reference early and often
    Bernd Alheit
    Community Expert
    Community Expert
    March 15, 2020

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

    Legend
    March 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.