Replace fonts in all documents in a book

Learn / Forums / General InDesign Topics / Replace fonts in all documents in a book

Viewing 4 reply threads
  • Author
    Posts
    • #85977
      Jim Swift
      Member

      New to Indesign Book files…
      How do you do a font replacement for missing fonts in all files in a book. I assumed that if I opened all the documents in a book and did a font find and replace in the source document using change all, then the missing fonts in all the other documents would be replaced,

      But it does not seem to work that way.

      I hope I don’t have to do the same find and replace in each documents in the book?

      Jim

    • #86000
      Ari Singer
      Member

      This can definitely be scripted. I’m afraid I don’t have the time now, but maybe one of the fine scripters on this site can write something for you (“Peter, Kai, Jongware, can you hear me?…”).

      But this is only another indication on why you should always use styles. If you would have used consistent styles throughout the book then changing the broken font would’ve been a breeze. You just update the paragraph style with the broken font in one document, sync all the documents’ styles to this document, and everything would be fixed instantly.

      But I believe it’s not your fault anyway, because if any fonts are missing then it makes sense to think that someone else created the document and not you…

    • #86001
      Jim Swift
      Member

      Yes, this is an old book.
      The styles are consistent through the book and I did update the styles in the source document and sync. But when I opened another document, I got the missing fonts message. Maybe I made a mistake in that process. I will look again at that tomorrow.

      Many thanks for the pointer.

      Jim

    • #86006

      Maybe too late, but I wrote the attached lines a year ago and they might be helpful:

      if (app.books.length != 1) {
        alert("Please open one book!");
        exit();
      }
       
      var userInterAct = app.scriptPreferences.userInteractionLevel;
      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
       
      var curBook = app.books[0];
      var allDocuments = curBook.bookContents;
      app.findTextPreferences = app.changeTextPreferences = null;
       
      for (var n = 0; n < allDocuments.length; n++) {
        var curPath = allDocuments[n].fullName;
        var curDoc = app.open(File(curPath));
          
        changeFont("Minion Pro\tItalic", "Myriad Pro\tItalic"); // enter here your fontnames
        curDoc.save();
        curDoc.close();
      }
       
      function changeFont(currFont, ChangeFont) {
        app.findTextPreferences.appliedFont = currFont;
        app.changeTextPreferences.appliedFont = ChangeFont;
        app.activeDocument.changeText();
      }
      	
      app.findTextPreferences = app.changeTextPreferences = null;
      app.scriptPreferences.userInteractionLevel = userInterAct;
      

      The two fonts must be entered in the line ‘changeFont(); The tab (\t) devides the font family from the font style and must be set.

      Kai

    • #86025
      Jim Swift
      Member

      Thanks, very much, for that script.
      I revisited the steps that ari mentioned and which I had done earlier.
      The missing font messages were still there after the first, much there were lots of local overrides.

      I repeated the sync this morning and this time also did a search and replace of just the styles and that seems to have solved the problem

      Thanks again

      Jim

Viewing 4 reply threads
  • You must be logged in to reply to this topic.
>