Print
Category: JS Illustrator
Also available:  Français (FR) 
Hits: 27576

When you open in Illustrator a PDF file generated from InDesign or QuarkXPress, you certainly noticed that the paragraphs are always split into several text frames, at least one for each text line but often you even see multiple contiguous text frames on the same line. If you do not have available the source file and you want to be able to edit the text from the PDF using Illustator, it is more convenient to have one single text frame with several lines, where you can then insert or delete words or whole lines, modify the leading, alignment, kerning, tracking, etc.

As i promised you in my first article "Fit a text to an outline", here is a script that will enable you to merge text parts together to get multi-line text frames.

This script could still be improved but it would be a pity to keep on indefinitely waiting for it to be perfect before publishing it, when it is already very useful to me since long in its current state. I first named it "recreate paragraph" but this script for the time being doesn't build multi-line paragraphs with uniform leading and lines separated by ¬, it rather builds multi-line text frames with lines separated by ¶ (that is, single-line paragraphs). Considering my intensive use of this script, i didn't build dialogs to edit the variables such as the "add-baseline-shift threshold" or the "same-line threshold", which could sometimes be useful but would most of the time slow down the usage[1].

Rather than having to answer each time to a dialog box, i made two versions of this script:

  1. "merge-into-one-line_ai.jsx" attempts to merge all selected text frames into one single line, adding some "baseline shift" to the non-aligned texts parts in order to keep the aspect, and is suitable for example when you want to merge on a same line several text frames including some offset split parts resulting from superscript or subscript.
  2. "merge-into-one-text_ai.jsx" merges on a same line only actually vertically aligned text frames (with a 1pt tolerance), then merges the lines into one single multi-line text frame, seeks the alignment mode that best preserves the initial horizontal distribution (left, center or right) and the leading preserving the vertical distribution[2].

reconstituer paragraphe ai 002

Note: this script only copes properly with straight horizontal text frames, it is not intended for the type on a path or area type, nor for the transformed text, especially rotated.

This functionality is now integrated into the «Text Rebuild Tools» extension for Illustrator CC+

[1] Illustrator unfortunately doesn't allow to create ScriptUI palettes but only dialog boxes that you have to answer to each time by "OK" or "Cancel", so I later created a HTML5 panel.

[2] See an improved version in «Text Rebuild Tools» dealing with actual multiline paragraphs and offerrring to rather play with other parameters such as left/right indent, space before/after, 1st line left indent, etc.

2 thoughts on “Rebuild broken text in Illustrator”

  1. THANK YOU for this! You don't even know how much time these scripts have saved me in rebuilding a brochure in ai from an ancient pdf. You're a saint.

  2. Thank you – this is brilliant! A huge time saver!

Leave your comment

In reply to Some User