3 Replies Latest reply on Jan 23, 2012 12:16 PM by try67

    closeDoc is interrupting a batch run script in Acrobat X

    pettyjp

      I am using a batch script to split a PDF file and then process (send via email) the individual pages.  Because extractPages opens the new page each time it's called, I had inserted a closeDoc referencing the new doc object so that I didn't end up with multiple open pages or crash Acrobat.  The script below worked fine when tested in Acrobat 8, but in Acrobat X I get a Dead Object error, so I've commented this out.  The script below is just a snippet from a larger script, but it does work in A8, all of those variables are defined and have values within the process.

       

      I checked the API and it says:

      In versions of Acrobat earlier than 7.0, a document that closes itself by executing this.closeDoc

      terminates any script that follows it. In Acrobat 7.0, the script is allowed to continue and to terminate

      naturally. However, if the Doc of the closed document is referenced, an exception will be thrown.

       

      I am not referencing the document object called 'send_document' after this call except in if statements that won't be run, is this still an issue, that the doc object is referenced at all?  Would it help to use a different variable name for the doc object in each section of my if/then statement?

       

      Right now I'm being forced to work around it because I can close all the open documents at the end, but Acrobat crashes if we open more than 50 docs, and we do have multipage PDFs with more than 50 pages we need to process.  Does this seem like an error I should report or an issue with how I'm implementing closeDoc?

       

           send_document = this.extractPages(cnt, cnt) ;

                  send_document.mailDoc(

                  {

                      bUI: false,

                      cTo: send_to,

                      cSubject: subject_line,

                      cMsg: message_text

                  }

                  );

                  send_document.closeDoc(true) ;

       

      Thanks ahead for any clues/help,

      JP