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

Is it possible to programmatically modify or create a large number of graphic files at once?

Community Beginner ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Hello.

I don't understand graphic tools and their capabilities at all, but I heard that Adobe Illustrator is a very popular tool, so the first thing I decided to do was come here for help.

Let's say I have a picture created with Adove Illustrator that shows a dog in front of a tree. Is it possible in some way to automatically (maybe using some scripts) generate 30 other pictures from this picture, in which instead of a dog there will be other animals (which are separate pictures created in Adobe Illustrator)? Or can it only be done manually?

Thank you.

TOPICS
Scripting

Views

388

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

correct answers 1 Correct answer

LEGEND , Sep 09, 2022 Sep 09, 2022

I've used your question as learning opportunity. This script will replace the top page item of the active file with each Symbol in the file and export a PDF. I've included a file with 3 symbols for testing. You could add more. In reality you'd probably want to access the unique "animal" files from a folder.

• Copy the script and save as ".jsx" file in any text editor.
• Run script from "Other Scripts" menu:

rcraighead_1-1662758553254.png

 

 

swapSymbols();

function swapSymbols() {
    var aDoc = app.activeDocument;
    for (i = 0
...

Votes

Translate

Translate
Adobe
Community Expert ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Illustrator has a Variables palette that allows to create various dynamic states (e.g. Layer visibility variables or linked files variables). That may be one way to go.

 

Also, Illustrator's symbols come to mind which can be another way.

 

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 Beginner ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

LATEST

I'll try to look into what you described in your question, thanks a lot!

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
LEGEND ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

I've used your question as learning opportunity. This script will replace the top page item of the active file with each Symbol in the file and export a PDF. I've included a file with 3 symbols for testing. You could add more. In reality you'd probably want to access the unique "animal" files from a folder.

• Copy the script and save as ".jsx" file in any text editor.
• Run script from "Other Scripts" menu:

rcraighead_1-1662758553254.png

 

 

swapSymbols();

function swapSymbols() {
    var aDoc = app.activeDocument;
    for (i = 0; i < aDoc.symbols.length; i++) {
        var oldSymbol = aDoc.pageItems[0];
        var newSymbol = aDoc.symbolItems.add(aDoc.symbols[i]).position = oldSymbol.position;
        var mySymbolName = aDoc.symbols[i].name;
        aDoc.symbolItems[0].translate(0, (-oldSymbol.height + aDoc.symbolItems[0].height));
        oldSymbol.remove();
        mySaveFileToPDF(mySymbolName);
    }
}

function mySaveFileToPDF(mySymbolName) {
    var aDoc = app.activeDocument;
    if (app.documents.length > 0) {
        var saveName = new File('~/Documents/' + mySymbolName + '.pdf');
        saveOpts = new PDFSaveOptions();
        saveOpts.pDFPreset = "[Illustrator Default]";
        PDFSaveOptions.generateThumbnails = true;
        PDFSaveOptions.acrobatLayers = false;
        aDoc.saveAs(saveName, saveOpts);
    }
}

 


Here is the sample file containing 3 Symbols:
dog.pdf

rcraighead_0-1662758362442.png

 



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 Beginner ,
Sep 09, 2022 Sep 09, 2022

Copy link to clipboard

Copied

Wow, thanks a lot. I do not have enough competencies to understand and comment on the code right now, because I am only at the beginning of the journey. It was important for me to understand whether such intervention is possible using code in Adobe Illustrator. Judging by your answer - maybe 🙂 Once again, thank you very much for spending your precious time and helping me!

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