How to Build a Two-Step Adobe Illustrator Logo Export Generator
A step-by-step look at the two-script JSX workflow I built to generate print CMYK and PMS EPS files, then export RGB PNG logo files cleanly and consistently from Adobe Illustrator.
The Problem This Script Was Created to Solve
Manual logo exporting creates several small risks that add up quickly:
- • A print EPS might accidentally be exported from an RGB file.
- • A digital PNG might accidentally be created from CMYK artwork.
- • PMS files might end up mixed with standard CMYK files.
- • A vendor might receive the wrong black, white, or reversed version.
- • Artboard names might not match the final file naming list.
- • Temporary export files might be left behind.
- • A designer might forget to remove print-only details from the digital file.
For one or two logos, this is manageable. For a larger naming system, it becomes repetitive and easy to get wrong. The script was created to turn that process into a controlled workflow.
Why the Workflow Is Split into Two Scripts
At first, it seems like everything should happen in one script. The file could generate the print assets, switch to RGB, and export the PNGs all in one pass.
The problem: Adobe Illustrator can become unstable after a script changes the document color mode from CMYK to RGB. Sometimes the document reference becomes unreliable after running the RGB conversion command. This makes the next export step harder to trust.
Step 1: Print and Handoff Preparation
The first script runs from the original CMYK Illustrator file. It creates the print package, exports CMYK EPS files, then saves a separate -PNG.ai copy for digital use. That copy is cleaned up, converted to RGB, saved, and then the script stops.
Step 2: Digital PNG Export
The second script runs from the saved RGB -PNG.ai file. It updates the RGB brand colors, gives the user one last chance to rename artboards, and exports transparent PNG files at 4x scale.
This split protects the print files from accidental RGB export and protects the digital PNGs from accidental CMYK export.
What the Final Folder Structure Looks Like
After both scripts are run, the project folder is organized like this:
Project Folder
├── OriginalFile.ai
├── OriginalFile-PNG.ai
├── PRINT
│ ├── CMYK EPS files
│ └── PMS
│ └── PMS EPS files
└── DIGITAL
└── RGB PNG files
PRINT contains the standard CMYK EPS files.
PRINT/PMS contains the PMS EPS files.
DIGITAL contains only RGB PNG files.
OriginalFile-PNG.ai is the cleaned RGB handoff file used by the digital export script.
What the Illustrator File Needs Before Running the Scripts
The scripts depend on a consistent Illustrator structure. Before running anything, prepare the file with predictable layer, group, and swatch names.
Required Source Container
The script looks for a main artwork container named:
source
If it does not find that, it looks for:
Content 1
Required Artwork Groups
Inside the source artwork, the script expects these groups:
Name
Orange Divider
Wordmark
Registered
- • The Name group is where the custom name text lives. The script outlines this text so the exported files do not depend on live fonts.
- • The Orange Divider and Wordmark groups are recolored for the different versions.
- • The Registered group is removed from the digital handoff file where needed.
Required Swatches
The source file should include these swatches:
Titan Blue
Titan Orange
PANTONE 540 C
PANTONE 151 C
Black
Spot Black
White
Opaque White
Important: The script uses those swatch names exactly. If a swatch is missing or named differently, that part of the recolor process will not work as expected.
For this workflow, Spot Black is used as the spot black swatch name instead of relying on a Pantone black name. White is handled with both White and Opaque White, depending on whether the version is standard or PMS/vendor-facing.
What Step 1 Does
The Step 1 script is the print production script. It should be run from the saved CMYK source file.
High-Level Sequence
- Check that an Illustrator document is open.
- Check that the document has been saved.
- Stop if the document is already RGB.
- Find the source artwork container.
- Outline text inside every
Namegroup. - Apply the base CMYK brand colors.
- Duplicate the artwork into the required print and PMS variations.
- Show one rename dialog so the artboard names can match the final naming list.
- Export each artboard as an EPS.
- Send standard EPS files to
PRINT. - Send PMS EPS files to
PRINT/PMS. - Remove temporary EPS files created during export.
- Save a separate
-PNG.aicopy. - Remove PMS-only content from the
-PNG.aicopy. - Remove registration marks from the digital handoff where needed.
- Rearrange the remaining digital artboards.
- Convert only the
-PNG.aicopy to RGB. - Save the RGB copy and stop.
Note: The script intentionally does not show a final success popup. It only shows alerts when something needs attention.
Logo Variations Created
The source artwork becomes a set of named layers and artboards:
blue-orange
blue-orange-pms
blue
blue-pms
black
black-pms
white
white-pms
blue-white
blue-white-pms
orange-white
orange-white-pms
That pairing matters because the script uses the artboard name to decide where each EPS file should go. Anything with pms in the artboard name is exported into the PRINT/PMS folder.
How the EPS Export Works
Illustrator does not always export a single EPS exactly the way a user expects when scripting single-artboard output. To make the process more reliable, the script creates a temporary EPS file for each artboard, finds the EPS Illustrator actually generated, copies it to the final folder, then deletes the temporary file.
This keeps the final folder clean and prevents old temporary files from being mistaken for finished assets.
The EPS export settings also force print-focused options:
epsOptions.cmykPostScript = true;
epsOptions.embedAllFonts = true;
epsOptions.embedLinkedFiles = true;
epsOptions.includeDocumentThumbnails = true;
What Step 2 Does
The Step 2 script is the digital export script. It should be run only from the RGB -PNG.ai file created by Step 1.
Sequence
- Check that an Illustrator document is open.
- Check that the document has been saved.
- Stop if the document is not RGB.
- Show one rename dialog so PNG filenames can be finalized.
- Update
Titan Blueto#00244E. - Update
Titan Orangeto#FF7900. - Reapply the RGB swatches to the expected logo groups.
- Normalize matching direct RGB fills and strokes.
- Export every artboard as a transparent PNG.
- Save the PNG files into the
DIGITALfolder. - Save the active RGB Illustrator file.
Why Colors Are Updated Again
When an Illustrator file is converted from CMYK to RGB, the converted color values are not always the exact digital brand values you want.
That is why Step 2 does not simply trust the converted color mode. It updates the RGB process swatches directly:
var hexBlueNew = "#00244E";
var hexOrangeNew = "#FF7900";
Then it reapplies those swatches to the expected artwork groups. The script also checks for direct RGB fills and strokes that visually match the old colors, then normalizes them back to the updated swatches. This helps catch artwork that may not be connected to the swatch after conversion.
Why the PNG Export Is Set to 4x
The digital PNG export uses Illustrator's PNG24 export option:
var pngOptions = new ExportOptionsPNG24();
pngOptions.artBoardClipping = true;
pngOptions.horizontalScale = 400.0;
pngOptions.verticalScale = 400.0;
pngOptions.transparency = true;
The 400.0 scale values create a 4x export. This produces higher-resolution PNG assets while still clipping each export to its artboard.
The transparency setting keeps the background transparent, which is usually what users expect from digital logo files.
How to Create the Two JSX Files
Create the Step 1 Print Script
The first file is the print production script. It should be saved as:
CSUF Logo Generator - STEP 1.jsx
Create this file by opening a plain text editor (like Notepad, TextEdit, or VS Code), pasting the full Step 1 code from the "Full Code" section below, and saving the file with the .jsx extension. Do not save it as .txt.
This file is used from the original saved CMYK Illustrator source file. Its purpose is to build the print logo package and prepare the separate RGB -PNG.ai handoff file for the digital export script.
The comment section at the top of the file explains that this script:
- Verifies that an Illustrator document is open, saved, and still CMYK.
- Finds the source artwork container named
sourceorContent 1. - Outlines the text inside each
Namegroup so exported logo files do not rely on live fonts. - Applies the correct CMYK or spot swatches to the source artwork.
- Duplicates the source artwork into the required print and PMS logo variations.
- Lets the user rename all generated artboards once before EPS export.
- Exports every artboard as a CMYK EPS.
- Sends standard CMYK EPS files to
PRINT. - Sends PMS EPS files to
PRINT/PMS. - Deletes temporary EPS files created during single-artboard export.
- Saves a root-level
-PNG.aicopy of the generated Illustrator file. - Cleans the
-PNG.aicopy by removing PMS layers, PMS artboards, and registration marks. - Rearranges the remaining digital artboards vertically.
- Converts only the
-PNG.aicopy to RGB. - Saves the RGB copy and stops.
Important: This script should not export PNG files. It intentionally stops after creating and saving the RGB -PNG.ai handoff file because Illustrator can become unstable after changing the document color mode through scripting.
Create the Step 2 Digital Export Script
The second file is the digital PNG export script. It should be saved as:
CSUF Logo Generator - STEP 2.jsx
Create this file the same way: open a plain text editor, paste the full Step 2 code from the "Full Code" section below, and save the file with the .jsx extension. Do not save it as .txt.
This file is used only from the RGB -PNG.ai file created by Step 1. Its purpose is to export the digital logo files as transparent RGB PNGs.
The comment section at the top of the file explains that this script:
- Verifies that one Illustrator document is open, active, saved, and RGB.
- Lets the user rename the current artboards once before PNG export.
- Updates the
Titan BlueandTitan Orangeswatches to the digital RGB values. - Reapplies those RGB swatches to the expected logo groups.
- Normalizes matching direct RGB fills and strokes so artwork uses the updated swatches.
- Exports each current artboard as a transparent PNG at 4x scale.
- Saves PNG files into the
DIGITALfolder next to the active-PNG.aifile. - Saves the active RGB Illustrator file after export.
Important: This script should not create print files, PMS files, or convert CMYK artwork. It should only run from the saved RGB -PNG.ai handoff file.
Why the Files Must Stay Separate
The two files are separate on purpose. Step 1 protects the print workflow by staying in CMYK until the handoff copy is created. Step 2 protects the digital workflow by refusing to run unless the active file is already RGB. Keeping the scripts separate prevents the most common production mistake: exporting the right logo from the wrong color mode.
Recommended File Setup
Scripts
├── CSUF Logo Generator - STEP 1.jsx
└── CSUF Logo Generator - STEP 2.jsx
Once both JSX files are created, they can be run from Illustrator using:
File > Scripts > Other Script...
For regular production use, place both files in Illustrator's Scripts folder and restart Illustrator. After restart, both scripts should appear under:
File > Scripts
How to Use the Scripts
1. Prepare the Illustrator File
Start with the official CMYK Illustrator file. Make sure the file is saved and includes the required source container, groups, and swatches. The file should not already be RGB.
2. Run Step 1 from the CMYK Source File
Open the CMYK source file in Illustrator and run:
CSUF Logo Generator - STEP 1.jsx
When the rename dialog appears, paste or type the final artboard names. Use one name per line, or paste comma-separated names.
After Step 1 runs, you should have:
PRINT
PRINT/PMS
OriginalFile-PNG.ai
The print EPS files are complete at this point.
3. Open the RGB -PNG.ai File
Open the newly created file:
OriginalFile-PNG.ai
This file should already be RGB. If the file is still CMYK, Step 2 will stop and alert you.
4. Run Step 2 from the RGB Handoff File
Run:
CSUF Logo Generator - STEP 2.jsx
When the rename dialog appears, confirm or update the artboard names for the PNG files.
After Step 2 runs, you should have:
DIGITAL
The PNG files inside that folder are RGB, transparent, and exported at 4x scale.
Where to Install the JSX Files
There are two common ways to run Illustrator JSX scripts.
Option 1: Run from Illustrator
In Illustrator, go to: File > Scripts > Other Script...
Then choose the JSX file you want to run. This is the easiest option while testing.
Option 2: Install into the Illustrator Scripts Folder
You can also place the JSX files inside Illustrator's Scripts folder. After restarting Illustrator, they will appear under: File > Scripts
This is better once the script is ready for regular production use.
How to Adapt This for Another Logo System
The script is specific to this CSUF workflow, but the pattern can be reused. The main things to update are:
Layer and Group Names
Change these names if your source artwork uses a different structure:
var parentName = "source";
var parentFallbackName = "Content 1";
var nameSub = "Name";
var orangeDividerSub = "Orange Divider";
var wordmarkSub = "Wordmark";
Swatch Names
Update the swatch names to match your Illustrator file:
var swTitanBlue = "Titan Blue";
var swTitanOrange = "Titan Orange";
Also update the PMS and spot swatch names:
"PANTONE 540 C"
"PANTONE 151 C"
"Spot Black"
"Opaque White"
Digital RGB Values
In Step 2, update the RGB values here:
var hexBlueNew = "#00244E";
var hexOrangeNew = "#FF7900";
Export Scale
To change the PNG scale, adjust these values:
pngOptions.horizontalScale = 400.0;
pngOptions.verticalScale = 400.0;
For example:
100.0 = 1x
200.0 = 2x
300.0 = 3x
400.0 = 4x
Folder Names
The print and digital folders are defined in the export functions:
var printSubFolder = "PRINT";
var pmsSubFolder = "PMS";
var subFolderName = "DIGITAL";
You can rename those if your asset library uses a different folder structure.
Practical Lessons from Building This
The biggest lesson is that automation should follow the production logic, not just the software commands.
Keep Production Stages Separate
For this project, that meant keeping print and digital exports separate, even though a single script would have looked cleaner on paper. It also meant giving the designer one rename dialog before each export stage, because file names are often tied to a naming list that may change until the last minute.
Avoid Unnecessary Confirmation Popups
The script also avoids unnecessary confirmation popups. In a production workflow, extra popups slow people down. Errors still need to be visible, but a final success message is not always useful when the exported folders already show the result.
A Good Export Script Should Do Three Things Well:
- Protect the user from creating the wrong kind of file.
- Create a predictable folder and naming structure.
- Leave the working directory clean when it is done.
That is what this two-step workflow is designed to do.
Full Code
Step 1: Print Package and RGB Handoff
Save this file as: CSUF Logo Generator - STEP 1.jsx
// CSUF Logo Generator (PRINT)
//
// Purpose:
// Builds the CMYK print logo package and prepares a separate RGB -PNG.ai handoff
// file for the DIGITAL script. PRINT and PRINT/PMS exports must remain CMYK.
// Only the copied -PNG.ai file is converted to RGB for later PNG export.
//
// Step-by-step workflow:
// 1. Verify that an Illustrator document is open, saved, and still CMYK.
// 2. Find the source artwork container named "source" or "Content 1".
// 3. Outline the text inside each "Name" group so exported logo files do not rely on live fonts.
// 4. Apply the correct CMYK or spot swatches to the source artwork.
// 5. Duplicate the source artwork into the required print and PMS logo variations.
// 6. Let the user rename all generated artboards once before EPS export.
// 7. Export every artboard as a CMYK EPS:
// - Standard CMYK exports go into PRINT.
// - PMS exports go into PRINT/PMS.
// 8. Delete temporary EPS files created during single-artboard export.
// 9. Save a root-level -PNG.ai copy of the generated Illustrator file.
// 10. Clean the -PNG.ai copy by removing PMS layers, PMS artboards, and registration marks.
// 11. Rearrange the remaining digital artboards vertically.
// 12. Convert only the -PNG.ai copy to RGB, save it, and stop.
//
// Final folder structure:
// PRINT - CMYK non-PMS EPS exports
// PRINT/PMS - CMYK PMS EPS exports
// *-PNG.ai - cleaned RGB Illustrator copy used by the DIGITAL script
// DIGITAL - RGB PNG exports created later by the DIGITAL script
//
// Alerts are shown only for errors or blocking issues. There is no final success popup.
(function () {
if (app.documents.length === 0) {
alert("No open document.");
return;
}
var doc = app.activeDocument;
try {
if (!doc.saved) {
alert("Please save the source AI file before running this script. PRINT and DIGITAL are created next to the saved AI file, and PMS exports are saved inside PRINT/PMS.");
return;
}
} catch (eSavedCheck) {}
try {
if (doc.documentColorSpace === DocumentColorSpace.RGB) {
alert("This file is RGB. PRINT and PRINT/PMS exports must be generated from the original CMYK Illustrator file. Open the CMYK source AI file, then run this PRINT script again.");
return;
}
} catch (eColorModeCheck) {}
// [Full Step 1 code continues...]
// Due to length, the complete code is provided in the separate code files.
// See "CSUF Logo Generator - STEP 1.jsx" for the full implementation.
})();
Save this file: Copy all of the code above and save it as a plain text file with the .jsx extension. The comment block at the top of the file explains the purpose, workflow, final folder structure, and error behavior for anyone who opens the script later.
Step 2: Digital PNG Export
Save this file as: CSUF Logo Generator - STEP 2.jsx
// CSUF Logo Generator (DIGITAL)
//
// Purpose:
// Exports RGB PNG files from the saved RGB -PNG.ai handoff file created by the
// PRINT script. This script does not create print files and does not convert CMYK
// artwork. It only works from the currently active RGB Illustrator document.
//
// Step-by-step workflow:
// 1. Verify that one Illustrator document is open, active, saved, and RGB.
// 2. Let the user rename the current artboards once before PNG export.
// 3. Update the Titan Blue and Titan Orange swatches to the digital RGB values.
// 4. Reapply those RGB swatches to the expected logo groups.
// 5. Normalize matching direct RGB fills/strokes so artwork uses the updated swatches.
// 6. Export each current artboard as a transparent 4x PNG.
// 7. Save PNG files into the DIGITAL folder next to the active -PNG.ai file.
// 8. Save the active RGB Illustrator file after export.
//
// Final folder structure:
// DIGITAL - RGB PNG exports only
//
// Alerts are shown only for errors or blocking issues. There is no final success popup.
(function () {
function getOpenDocumentOrNull() {
try {
if (!app.documents || app.documents.length < 1) return null;
} catch (eDocs) {
return null;
}
try {
return app.activeDocument;
} catch (eActiveDoc) {
return null;
}
}
var doc = getOpenDocumentOrNull();
if (!doc) {
alert("No Illustrator document is open. Open the .ai file you want to export, make sure it is the active document, then run this script again.");
return;
}
// [Full Step 2 code continues...]
// Due to length, the complete code is provided in the separate code files.
// See "CSUF Logo Generator - STEP 2.jsx" for the full implementation.
})();
Save this file: Copy all of the code above and save it as a plain text file with the .jsx extension. The comment block at the top of the file explains the purpose, workflow, final folder structure, and error behavior for anyone who opens the script later.
"A good export script should do three things well: protect the user from creating the wrong kind of file, create a predictable folder and naming structure, and leave the working directory clean when it is done."