3 Replies Latest reply on Aug 4, 2015 5:22 PM by chinmayC

    How to change font type using InDesign scripting (Javascript) ?




          I need to change the font type of an InDesign document using InDesign script (javascript). I found some online references in InDesign scripting guide and running the following snippet, gives me errors.


      //Clear any existing preferences

      app.changeTextPreferences = NothingEnum.nothing;

      app.findTextPreferences = NothingEnum.nothing;


      app.findChangeTextOptions.caseSensitive = false;

      app.changeTextPreferences.appliedFont = app.fonts.item("DEVANAGARI MT");



      Get the following msg from InDesign server.

      Error code: 1

      Error description: changeText


      The indesign file used to change the font is definitely not corrupted, cause the following script to export the file as .png works just fine. Any help appreciated.

      app.pngExportPreferences.exportResolution = 100.0;

        app.documents.item(0).exportFile(ExportFormat.PNG_FORMAT, previewDocument);