This is an old revision of the document!
Javascript
You can run Extendscript (Illustrator's built-in version of Javascript) to modify the file and path. Your code will be wrapped in a function so ensure that you include a return statement with the required data structure.
- Return an array with the find and replace values such as [{ find: “ABC”, replace: “123”},{find: “Cat”, replace: “Dog”}], which will be applied to the filename template
- Return false to cancel without error
- Return string to show as an error.
Variables passed your code
- 'path' is the destination path.
- 'filename' is the filename template.
- 'index' is the current artboard index.
- 'range' is the page range being used. i.e '2-4'
Functions
- Call getData(variable) to get the standard data from the table below, such as getData('doc.filename')
- Call setPath(path) to change the destination path
- Call setFilename(filename) to set the filename template (overwriting the existing filename template)
Filename
You can setup the filename template, and the values in the template will be replaced as the PDF file is exported.
{Variable} | Description | **Example Output* |
timestamp | Timestamp | 2024-02-03 14:33:12 |
time | Time HH:MM:SS | 14:33:12 |
weekday | Weekday | Monday |
shortweekday | Short Weekday | Mon |
day | Day | 3 |
month~Month | 7 | |
year~Year | 2024 | |
linked.filename~Filename of First Linked File | *Empty if none found | |
pdf.preset | PDF Preset Name | |
artboard.width | Artboard Width in document units | |
artboard.height | Artboard Height in document units | |
artboard.number | Artboard Page Number | |
artboard.name | Artboard Name | |
artboard.count | Total Artboard Count | |
export.number | Current count of pages being exported | |
export.count | Total Number of pages being exported | |
doc.rulerunits | Ruler Units | mm |
doc.colorSpace | Document Color Space | RGB |
doc.filename | Document filename | example.ai |
?Question | Uses the text to ask a question | {?Customer Name} will prompt for “Customer Name” |
Release Notes
2.3.0
- Added a Javascript option to allow changing of the path and filename for more automated workflows; for example, use the filename to set the correct path to save to.
- Allowed Subfolder creation in filename template.
2.1.0
- Added option to check spelling before creating PDF
2.0.2
- Fixed issue where UI was crashing
2.0.1
- Requires PowerScripts 3.4.2
- CC2018 Compatability Fixes
2.0.0
- Export artboards as separate files (NEW in 2.0.)
- Secure the PDF with just a click using a common password
- Add printers confidence strips for large format printers
- Export just the currently selected artboard, a range of pages or the entire document
- Automatically name the PDF, including adding: (NEW in 2.0.0)
- Custom text
- Timestamp, weekday name, day, month, year
- The Linked filename of a placed document
- Artboard size or name
- Artboard number
- Total number of Artboards
- Exported page count
- Document color mode (Helps to capture export errors downstream)
- Document filename
- Add in custom values which will ask for user input, such as a revision number
- Set a destination to save (NEW in 2.0.0)
- Last Exported to Folder
- Documents Folder
- Fixed Location
- Current document working folder
- Sub folder - creating it if it does not exist
- Prompt for filenames or save each file without asking
- Open the destination folder after exporting (NEW in 2.0.0)
- Set different defaults to use for quick reuse