• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Batch Processing a Find Font in Document

Explorer ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

I am wanting to have a script that will look in a folder/directory and...

- Open each .pdf file in that directory one at a time and do the following

     - Find Font in Document

          - Arial

     - Replace With Font From System

          - Courier New

- Save the file with default Illustrator PDF save settings in same location (in other words I don't need it to be saved as another file)

I would love to do this with minimal or no interaction from the user.

Any ideas if this is possible? Keeping in mind that each file will have 1,000's of text frames with the Arial font that need to be changed to Courier New.

Any help would be greatly appreciated!

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 11, 2017 Aug 11, 2017

Copy link to clipboard

Copied

If you familiar to JavaScript, You can use ExtendScript do that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I am familiar with JavaScript and ExtendScript....but this is beyond my abilities.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I'm not sure how to do this in AI, because I don't think there's any way to replicate the function of the Find Font dialog. Going through all the 1000s of text frames to check each character's font family name would most certainly be too slow on even a single file.

How can one accomplish this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

I always use mm:font properties in XMP meta data.

You can reference below link to help reading metadata.

Extend_Script_experimentals/XMPtool.jsx at master · ten-A/Extend_Script_experimentals · GitHub

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 15, 2017 Aug 15, 2017

Copy link to clipboard

Copied

Are the PDF files created in Illustrator with “preserve Illustrator editing capabilities” checked when saving? If not, opening a generic PDF into Illustrator may be problematic (Illustrator is not a general purpose PDF editor).

Prepression: The Ten Commandments of PDF

I would recommend Enfocus PitStop Pro for Adobe Acrobat Pro or the stand alone hot folder based Enfocus PitStop Server for this task.

EDIT: Do you have some random sample files? Depending on how the text is composed, changing the font (in any software) could lead to unexpected results…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 25, 2017 Aug 25, 2017

Copy link to clipboard

Copied

LATEST

Here is the code I am working with.... can anyone offer any suggestions/help?

#target illustrator

var arialText = app.textFonts.getByName("ArialMT")

var arialBold = app.textFonts.getByName("Arial-BoldMT")

//Set up vairaibles

var sourceDoc, sourceFolder;

var count = 0;

// Select the source folder.

sourceFolder = Folder.selectDialog('Select the folder with Illustrator files...', '~');

destDoc = app.documents.add();

// If a valid folder is selected

if (sourceFolder != null) {

    files = new Array();

    // Get all files matching the pattern

    files = sourceFolder.getFiles();

    if (files.length > 0) {

        // Get the destination to save the files

        for (xx = 0; xx < files.length; xx++) {

sourceDoc = app.open(files[xx]); // returns the document object

            var allText = sourceDoc.textFrames; // Select All layers in Active Document

for (i = 0; i < allText.length; i++) {

var textFieldRange = allText.textRange;

var textProps = textFieldRange.characterAttributes;

var textFrameFont = textProps.textFont;

if (textFrameFont == "[TextFont ArialMT]" || textFrameFont == "[TextFont Arial-BoldMT]" || textFrameFont == "[TextFont Arial-BoldItalicMT]" || textFrameFont == "[TextFont Arial-ItalicMT]" || textFrameFont == "[TextFont ArialNarrow]" || textFrameFont == "[TextFont Arial-Black]"){

// font is correct

}

else if (textFrameFont == "[TextFont MonospaceBT]"){

// change the font to ArialMT which is Arial Regular

textFieldRange.characterAttributes.textFont = arialText;

count++

}

else{

// change the font to Arial Bold

textFieldRange.characterAttributes.textFont = arialBold;

count++;

}

}

sourceDoc.close(SaveOptions.SAVECHANGES);

}

}

}

// Alerts based on count

if (count == 0){

alert("YOU'RE GOOD TO GO!\nAll text in this document are a form of Arial!");

}

else {

alert("Complete!\n" + count + " textFrames were not a form of Arial.");

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines