Copy link to clipboard
Copied
The latest version of Illustrator.
I am using batch actions to create many graphics versions with dynamic text and I am using an XML file to input the dynamic text variables. Some of the text is too long and goes beyond the artboard. I am trying to figure out a way to dynamically change the size of the text so that it will always fit within a defined width.
I haven't had any luck finding out if this is possible in Illustrator.
Thank you in advance for your help!
Mike
1 Correct answer
You can use this script of mine for shrinking the text, a very common problem.
Explore related tutorials & articles
Copy link to clipboard
Copied
Maybe you can detail the process a little further?
Also show the template document you use - are there point texts in it or area texts?
Copy link to clipboard
Copied
I've tried area and point text and neither resized the text to keep it within the area I defined. The screenshot below is a area type example of how the text adds rows when the text is to long to fit and uses the same text size.
Point type example below and how the text reacts to lengths longer than will fit.
Copy link to clipboard
Copied
I found this request in the Illustrator feature requests. https://illustrator.uservoice.com/forums/333657-illustrator-feature-requests/suggestions/37449973-re...
I've tried a couple of scripts I found that was supposed to do this but none of them produced any changes. If the option doesn't exist is there a script that will adjust the text size to that of the text box for longer text for variable input purposes?
Copy link to clipboard
Copied
You can use this script of mine for shrinking the text, a very common problem.
Copy link to clipboard
Copied
Hi Silly-V,
I came across your scripts last night. The problem maybe I don't know how to use scripts properly in Illustrator.
I copied your script into a new BBedit text document and saved it with the .JSX extension (see screenshot below).
I opened the existing artboard then I click File/Scripts/Other Scripts then navigate to the folder I saved DealWithOversetText_SingleLine.jsx. I then click on the area type text box and cycle through the variables. The characters don't resize and respond the same way they did before I loaded the script. I must not be doing something right.
Copy link to clipboard
Copied
I went back and quit Illustrator and copied the script into the scripts folder under /Applications/Adobe Illustrator 2020/Presets.localized/en_US/Scripts. I restarted Illustrator and loaded the script File/Scripts then clicked on DealWithOversetText_SingleLine.jsx. I created a new area type text box with the same results. I then changed the text box to point type with the same results.
What am I doing wrong?
Copy link to clipboard
Copied
This script is intended to be called by an action during the batch action process. It has to be stuck into your File/Scripts menu, which is a folder in your Illustrator application - wherever that is at. When you restart Ai, the new script menu item will appear and now you can use the actions' flyout menu to "Insert Menu Item" and thus add the script to the action. When you run the batch action, first the text will be replaced by Illustrator and then the action will play the script which will resize the text down to its box.
You can actually record an action which automatically cycles to next dataset and plays the script. This is what I call a "Preview" action because you can change datasets and play the script to test with without exporting a lot of files.
Copy link to clipboard
Copied
And a special feature of the script is to record the font size which is used in your text boxes IF you are on the very first dataset. If this is recorded (and it gets recorded every time this script runs and you are on the first dataset), then the next time it will reset your text to that size. This feature is for when your text is so long that it gets shrunk, but the next dataset's text is shorter and you don't want it to still remain small, it should occupy the whole box.
Copy link to clipboard
Copied
Thank you for the explanation. The script worked great!
Solutions many times lead to new questions Haha
Some of the titles are so long they wind up very small. Is there a way to add a row in the script if the size falls below a certain character size?
Copy link to clipboard
Copied
That would take some customized work. There are some wacky hacky almost work-arounds (https://www.linkedin.com/pulse/vertical-text-centering-via-forced-thread-reflow-vasily-hall/) but for this kind of requirement would be best if someone took all your cases and worked with you to make your perfect variable-data thing. Because now it's a matter of sizing different lines to make sure one isn't bigger than the other, and the biggest one is the line flush with the box - plus you probably don't want words to be split awkwardly, so there's got to be some logic deciding on how exactly to handle the splitting and whether some words belong together, etc.
Copy link to clipboard
Copied
Thank you, I appreciate all of your help!

