Export all open docs as PDF

I am working on a script which should export all the open docs as PDF.
I use the following script to export. but InDesign does not export all the PDF. Assume, I have opened seven docs and the script exports only 4 docs and again come back to the first exported doc. can any one help how to resolve the issue.
var myTotalDocs = (app.documents.length);
    for(var i = 0; i < myTotalDocs; i++)
        myDocument = app.documents[i];
        app.activeDocument = myDocument;
        var myFilePath = app.activeDocument.filePath;
       app.activeDocument.exportFile(ExportFormat.pdfType, File(myFilePath+"/"+".pdf"),false);
Thanks

Dear Ramji
Please use the below code for solving your problem:
//===================== Start : Export =================================//
var myTotalDocs = (app.documents.length);
    for(var i = 0; i < myTotalDocs; i++)
        myDocument = app.documents[i];
        app.activeDocument = myDocument;
        var myFilePath = app.activeDocument.filePath;
       app.activeDocument.exportFile(ExportFormat.pdfType, File(myFilePath+"/"+".pdf"),false);
    myDocument.close(SaveOptions.NO);
//===================== End: Export =================================//
Once Export the InDesign open document then immediatly close... otherwise this problem [what you menditoned] will occure.
Thanks & Regards
T.R.Harihara SudhaN

Similar Messages

  • Export all open files to jpeg = bug?

    hi there!
    I'm currently writing a script that exports all the open documents to a JPEG.
    this works except for one little thingy:
    instead of exporting all the documents, it exports only the active one, with all the other document names...
    so for example:
    3 files opened, 3 files exported with a different, correct filename, BUT every jpeg shows the active file.
    I don't know what I'm doing wrong, so if someone could jump in = AWESOME!
    TY!
    M.
    this is my code:
    try {
        if (app.documents.length > 0 ) {
            // Get the folder to save the files into
            var destFolder = null;
            destFolder = Folder.selectDialog( 'Select folder for JPG files.', '~' );
            if (destFolder != null) {
                var options, i;
                // Get the Flash export options to be used.
                var options = new ExportOptionsJPEG();
                // You can tune these by changing the code in the getOptions() function.
                for ( i = app.documents.length-1; i >=0 ; i-- ) {
                    // Get the file to export the document as swf intos
                    var targetFile = new File( destFolder + '/' + app.documents[i].name +".jpg");
                    // Export to flash
                    app.documents[i].exportFile(targetFile, ExportType.JPEG, options);
                    app.documents[i].close();
                alert( 'Documents exported as JPG' );
        else{
            throw new Error('There are no document open!');
    catch(e) {
        alert( e.message, "Script Alert", true);

    Changing your 'for' loop to a 'while' loop and working with 'activeDocument' rather than documents[i] works fine for me…
    Like so…
    try {
        if (app.documents.length > 0 ) {
            // Get the folder to save the files into
            var destFolder = null;
            destFolder = Folder.selectDialog( 'Select folder for JPG files.', '~' );
            if (destFolder != null) {
                var options, i;
                // Get the Flash export options to be used.
                var options = new ExportOptionsJPEG();
                // You can tune these by changing the code in the getOptions() function.
                while (app.documents.length > 0) {
                    // Get the file to export the document as swf intos
                    var targetFile = new File( destFolder + '/' + app.activeDocument.name +".jpg");
                    // Export to flash
                    app.activeDocument.exportFile(targetFile, ExportType.JPEG, options);
                    app.activeDocument.close();
                alert( 'Documents exported as JPG' );
        else{
            throw new Error('There are no document open!');
    catch(e) {
        alert( e.message, "Script Alert", true);

  • Run in all open docs

    I'm trying to run this script  in all open  ID docs but it's only changing only 1 document instead of all . I know is something simple but I can't figure it out. Please advise where am I making the mistake.
    tell application "Adobe InDesign CS4"
    activate
              repeat with i from 1 to count of documents
                        set myFiles to active document
                        tell myFiles
                                  try
                                            try
                                                      set theListOfColors to (every swatch whose model is spot and name begins with "P 555")
                                                      set properties of item 1 of theListOfColors to {model:process, space:CMYK, color value:{0, 0, 0, 100}}
                                            end try
                                            try
                                                      set ListOfColors to (every swatch whose model is process and name begins with "P 555")
                                                      set properties of item 1 of ListOfColors to {model:process, space:CMYK, color value:{0, 0, 0, 100}}
                                            end try
                                            try
                                                      set (model of every color whose model is spot) to process
                                            end try
                                  on error the error_message number the error_number
                                            set the error_text to "Error: " & the error_number & ". " & the error_message
      display dialog the error_text buttons {"OK"} default button 1
                                            return the error_text
                                  end try
                        end tell
              end repeat
    end tell

    I'm no AppleScripter, but it seems to me that if you go to the trouble of setting up a variable I to walk through the documents you should use it.
    I'd say it's bad form to use "myFiles" as the name for a variable that holds a reference to a single document.
    Someone might need to backstop my code, but you should be able to use:
    repeat with myDoc in documents
    tell myDoc
    Dave

  • Acrobat 10 - Where's the print all open docs function?

    In Acrobat 9 I was able to go to Advance->Batch Sequences->Print All
    Then all of the documents that were opened would be printed, and if you wanted to it could Print All without saving.  This was a very useful feature that I no longer have access to.   I have to confirm every document I wanted printed and I don't see an option to print all opened documents.
    Am I missing something?
    -PixelMuse

    Batch processing has been removed from Acrobat X - instead there are Actions.
    While it's possible to replicate the "print all open files" sequence to some extent, the interactivity of Actions is different, so it can't work seamlessly. For that reason it isn't in the default set of actions shipped with Acrobat X.

  • OAM Access Manager SSO solution fails to open docs and pdfs

    Hi
    I have created a solusion for SSO like this.
    OAM against AD, running on windows (server A). Webpass is on IIS.
    The applikation I'm protecting is an Weblogic 10.0 application running on windows (server B)
    I have also installed the webgate on serverB running on Apache 2.0, and all the installation is done by following the documentation for Weblogic sso
    (This is to make the application runnable directly through port 80 and redirecting in Apache)
    The sso works fine.
    But i have a problem in IE6
    When the application is trying to open documents to view them in msword or pdf for printing, the document is not opened, I get an "file not found" exeption in the browser, and the url for getting the document seems very long. (The grey popup)
    When I open the application in IE8 it works fine, and the url for getting document seems short (just the docID)
    (The application is currently only compatible for IE6 so running it in IE8 will cause other problems)
    I cannot find any error messages in any logs.
    If I run the excact same application without sso its working fine in both IE8 and IE6
    Regards
    Tine

    Hi
    This is a followup to the question in this thread
    The system is now able to load pdf's and doc documents, and the reason it did not work before was due to the cache settings on the webgate. The system is now caching documents in the temporarInternetfolder created for the users and loads word and pdf files for printing without problems.
    Now.. my problem is that the application is also running a kind of "generate pdf, doc, html files" application which are saving some modified files on the local users area. (my computer)
    After that the application ask to load these documents into the applications database.
    When I use the Apache mod_weblogic.c to proxy the requests, large files (5 MB) are not able to be loaded into the application database. I get a "the connection with the server was terminated abnormally" exeption.
    Small files (94 KB) are working fine.
    Does anyone have any idea of what can cause this?
    I have upgraded Apache from 2.0.58 to Apache 2.0.63 and I use mod_wl128_20.so as the weblogic module.
    Regards
    Tine

  • Why did 3 different hyperlinks all open to same pdf?

    I double checked to make sure in the inspector that all of my hyperlinks were linked to three different pdf files, however, when the site was published, all three pdf files opened to the same one, which happened to be the first one that was linked.

    Welcome to the Apple Discussions. I've gotten that with hyperlinks to pages before. Go thru the linking again and this time do a save of the domain file, activate the links in iWeb and try there. Also you can publish to a folder on the desktop and run the site locally and see if the links work as expected. Quicker than publishing to the server to check the links.
    OT

  • Password requested to open doc in PDF

    i downloaded a catalogue sale flyer and Adobe is requesting a password to open the document. I have tried user name password no dice   Can anyone assist me?

    You'll need to get the password from the company/person who created the document. If it was from a website, you'd need to contact them. They may have inadvertently uploaded their password-protected version.

  • Could somebody tell me how to keep my fonts when sharing/sending/exporting a Pages doc to PDF?, it changes it every time

    I need to share PDF versions of my documents, but after use different options the result is the same, the fonts are changed and the documents look different. Does anyone knows how to avoid this?, I recently switch from a Macbook Intel late 2008 and I used to work by Printing to PDF without any trouble, however, that option on my new Mac Air does not work anymore.

    I was ASSUMING that it is 2gb because it always synced just fine with my 2gb shuffle.
    That doesn't appear to be the case now.  You can view the size of your Music library by browsing to the Music section of your iTunes library and looking at the number provided towards the bottom bar of the iTunes window. '
    And if I went to add more music folders to my library, when it would try to sync, it would tell me that my shuffle was at capacity.  So I was removing albums from my library so that it would sync.
    Again, as I stated above, you don't need to do this.  You could have just configured your iPod to sync a subset of your iTunes music library.
    Did you see the article I referenced above?
    B-rock

  • Command in Java for "all opened documents"

    I have a script that needs modification. Thank you all in the forum for helping me design this script from start btw!
    Anyway, this is the script.
    var myDoc = app.activeDocument;
    app.findGrepPreferences = app.changeGrepPreferences = null;
    // Change "Condition 1" to name of your condition
    myConditionList = app.activeDocument.conditions.everyItem().getElements();
    for (i=myConditionList.length-1; i>=0; i--)
        if (myConditionList[i].visible == false)
            myConditionList[i].visible = true;
            app.findGrepPreferences.appliedConditions = [myConditionList[i].name] ;
            app.findGrepPreferences.findWhat = ".+";
            myDoc.changeGrep();
            app.activeDocument.conditions.item(myConditionList[i].name).remove();
    I'm looking for a variable that can apply for "all" opened documents rather than the active one only. I'm having difficulty finding the right command.
    BTW, the script removes all hidden text and objects.

    Programming has never been my strong side. Never understood it properly and probably never will =(. But thank you solving it. The code "JUMO_OVER" wrote, worked like charm. No need to execute the script 10x for 10 documents.
    Pardon me for giving you guys more out headaches, I have two additional scripts that needs revision for the same purpose as above, i.e. able to exceute the scrip for all opened docs, saved or unsaved. I would really appreciated if you guys could help me convert them. I tried it do it on my own own, but I can't get it working... =(
    Delete Empty Frames in active doc
    var myStories = app.activeDocument.stories.everyItem().getElements();
    for (i = myStories.length - 1; i >= 0; i--)
        var myTextFrames = myStories[i].textContainers;
        for (j = myTextFrames.length - 1; j >= 0; j--)
            if (myTextFrames[j].contents == "")
                myTextFrames[j].remove();
    Delete Empty Pages in active doc
    app.doScript("main()", ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT,"Remove  Blank Pages");
    function main () {
        if (app.documents.length === 0) {
            alert ("Please open a document.");
            return;
        app.scriptPreferences.enableRedraw = false;
        removeBlankPages (app.Documents);
        app.scriptPreferences.enableRedraw = true;
        function removeBlankPages (doc) {
            var pages = doc.pages.everyItem().getElements().slice(0);
            var i = pages.length;
            while (i-- >1) { // a bit quicker here
                !pages[i].allPageItems.length && pages[i].remove ();
            !pages[i].allPageItems.length && pages[i] != doc.pages[-1] && pages[i].remove ()
    BTW, I didn't write them. So they may look quirky in your eyes.

  • How to export all images that don't contain editable text

    Hi guys,
    Is there any hack, script or general function to export all images from a PDF withouth them containing editable text?
    For instance, i have a pdf that contains some scanned documents - these need exporting, i also have some tables in there that have editable text in them - these are being exported when i select export all images.
    Can anyone help?
    Cheers!

    Search for a word or words in them as a group. Search for .pdf file type and containing....
    Use a common word that they all might contain such as "a" or "the", etc.
    The files that have been OCR'd will show up in the search. This won't catch 100% of them, but it will allow you to separate most of them.

  • Acrobat DC - export all images

    In the previous version you could export all images in a pdf-document through the menu: Tools > Document Processing > Export All Images
    Adobe Acrobat X Pro * Export images to another format
    Is it still possible to do in Acrobat DC ?
    Thank you for any answer.

    Hi Aline ,
    This is absolutely possible in Acrobat DC as well .
    In Acrobat DC ,the procedure to navigate to Export PDF option is a two step method .
    You could select the Export PDF option directly by choosing the Tools option .You will see a Export PDF option either on the right hand side or in the first row after you select tools .
    Regards
    Sukrit Dhingra

  • Run applescript on all open documents

    hi all,
    I have an applescript that was created to run on the active document. I dont have any applescript abilites but would like to change it to run on all open documents. the script removes all unused master pages and i would like it to run on all opened docs. what do i need to change to make it work?
    here is the script....
    set moreMasters to {}
    tell application "Adobe InDesign CS3"
        tell document 1
            set allMasters to every master spread
            set theMasters to applied master of every page
            repeat with x in theMasters
                set end of moreMasters to applied master of x
            end repeat
            set theMasters to theMasters & moreMasters
            repeat with x in allMasters
                if x is not in theMasters then delete x
            end repeat
        end tell
    end tell
    thanks in advance
    Dan

    Rather than using the numeric index, you can also leave that to AppleScript.
    tell application "Adobe InDesign CS4"
         repeat with doc in documents
              tell doc
                   set theName to name -- of doc
                   display dialog theName
              end tell
         end repeat
    end tell

  • I cannot open all email attachment files(pdf, doc, etc) in Mail on my New IPad.

    I cannot open all email attachment files(pdf, doc, etc) in Mail on my New IPad. I installed all viewer apps but I am not able to click and hold to select the option of viewer apps to open the files. I dont get the "open with" option when I click on the arrow in the menu bar. I can open attachment files on G-mail website from Safari though. It is really ridiculous that I cannot open the files from Apple Mail app! What's wrong with it!!

    We cannot possible know what's wrong with it. But we can offer suggestions that might help.
    Try resetting the iPad - its like rebooting a computer.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This might help as well.
    You can try resetting all settings. Settings>General>Reset>Reset All Settings. You will have to enter all of your app preferences and device settings again

  • With the automatic addition of an update on both home & work computers, attachments went from being identified & opened as appropriate files, even when identified as .doc or .pdf, etc., all become .ashx

    With the automatic addition of an update on both home & work computers, attachments went from being identified & opened as appropriate files, even when identified as .doc or .pdf, etc., all become .ashx (see details below)

    With the automatic addition of an update on both home & work computers, attachments went from being identified & opened as appropriate files, even when identified as .doc or .pdf, etc., all become .ashx (see details below)

  • How to set pages to export all doc's in PDF format as default

    Could anybody tell me how I can set pages to save/export all the documents produce in PDF format. I run a small plumbing company and like to send all my estimates in PDF.

    You can use Automator action –Launch AppleScript, insert following code into:
    set destF to (path to desktop folder)
    tell application id "com.apple.iWork.Pages"
      set fName to name of the front document as string
      set fName to text 1 thru -7 of fName
      set destLoc to ((destF as string) & fName & ".pdf")
      export front document to file destLoc as PDF
    end tell
    Select no input, you can limit this service for Pages only (not necessary), and save it as Service.
    In system Preferences you can now add shortcut for this action.
    Script always export front (active) document to PDF on your Desktop (overwrite existing!!).
    This could help: http://www.ostricher.com/2014/12/how-to-assign-keyboard-shortcuts-for-os-x-apps/

Maybe you are looking for

  • I keep getting a revocation of certificate prompt when using Skype.

    Since both Microsoft & Mozilla updated their security, every time I log onto Skype I get a Revocation of Certificate prompt. How do I fix or eliminate this on Skype?

  • How to automatically generate a build file of the application from command-line

    Hi All How can we automatically generate a build file of the application from command-line (as opposed to using Jdev IDE to click to generate a build.xml) ? Thanks

  • None of my OS 9 drives will boot...

    Hi All, Encountered a problem that only just started happening today...No HD that i install OS 9 onto will boot... Ive always installed OS 9 using a cd copy of the retail version of 9 (i.e a CD-R that i made of the OS 9 disk image, not an actual reta

  • How to properly use/write a SecurityManager?

    Greetings and salutations, it's a fine Sunday afternoon overhere and I'm embedding BeanShell (www.beanshell.org) in one of my applications. Everything works fine but one thing: BeanShell is way too powerful for humble users. If I intended them to ent

  • Tutorial - Building Business Components

    I am using Oracle JDeveloper3.0 (Build 532) on Windows NT. I am trying to work through the above tutorial, but when I try to invoke the Business Components or New Entity Objects, nothing happens. Have not installed some components correctly ? Do I ne