Skip to main content
dublove
Legend
Oct 5, 2026 4:21 PM UTC
Question

How to determine if a PDF with the same name at the current location is open?

I export a PDF using the following statement, but sometimes there are exceptions. Later, I found out that a PDF with the same location and name is open.

Like this:

var myPDFFile = new File(desktopPath + "/" + exPDFname + "/" + getpRange + ".pdf");
//if (myPDFFile.isOpen) {
// alert('Please close the PDF with the same name first');
//}
myDocument.exportFile(ExportFormat.PDF_TYPE, myPDFFile, false, preSle);

Or more scientifically:
Automatically close the 'myPDFFile' currently open in Acrobat.

    4 replies

    rob day
    Community Expert
    Community Expert
    Oct 5, 2026 7:01 PM UTC

    Automatically close the 'myPDFFile' currently open in Acrobat.

     

    I don’t think you can do it. BridgeTalk is the way to communicate between Adobe apps, but there is no BridgeTalk/ExtendScript support for Acrobat. On MacOS it could be done via Applescript 

    Translate
    dublove
    dubloveAuthor
    Legend
    Oct 5, 2026 8:44 PM UTC

    It doesn't have to be confirmed that it was opened by Acrobat.
    If it can know that the file is currently occupied and a prompt pops up, I can also manually close it.

    Translate
    rob day
    Community Expert
    Community Expert
    Oct 5, 2026 9:17 PM UTC

    I don’t see a way. You can look at the File object methods, but that wouldn’t tell you if a PDF with the same name as the one you are exporting is currently open.

     

    https://www.indesignjs.de/indesignapi/javascript/File.html

    Translate