MakeTrappingStroke.jsx
It automatically creates a “trapping stroke” for selected vector objects in Illustrator — a common step in prepress work to prevent tiny white gaps between colors when printing.

What it Does
The MakeTrappingStroke.jsx script automates color trapping in Adobe Illustrator. It takes each selected filled object, matches its stroke color to the fill, and enables Overprint Stroke for proper print overlap. You can set stroke weight, units, and force-add strokes through a simple UI. The result: smoother, print-ready outlines that prevent color gaps and improve press alignment.
When you run the script:
- It checks that you have a document open and objects selected.
- For each selected path or compound path with a fill color:
- It creates or adjusts a stroke (outline) based on the object’s fill color.
- The stroke color matches the fill color.
- The Overprint Stroke option is automatically turned on (important for trapping).
- Stroke ends and corners are made rounded for smoother edges.
- You can choose the stroke width (default 1pt, with an option to use mm).
- It can force-add a stroke if none exists.
- The script provides a small UI panel that lets you:
- Set stroke weight and units (pt or mm)
- Enable “Force add stroke”
- Preview the effect before applying
- It skips any objects with pattern fills or no fill color and alerts you afterwards.
Before running the script, the butterfly artwork has blue fills with thin red strokes that don’t match the fill color or trapping settings. After applying MakeTrappingStroke.jsx, the script matches stroke and fill colors, thickens outlines, enables Overprint Stroke for proper trapping, and rounds edges — resulting in smooth, print-ready artwork.
In print design, “trapping” compensates for misalignments during printing by slightly overlapping colors. This script makes it easy to automate that process in Illustrator, ensuring cleaner printed results.