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.
Rather than having to answer each time to a dialog box, i made two versions of this script:
- "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.
- "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.
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.
 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", maybe in the future i will rather try to create a HTML5 panel.
 Ideally an improved version dealing with actual multiline paragraphs could offer to rather play with other parameters such as left/right indent, space before/after, 1st line left indent, etc.