Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for professional graphic designers and non-designers trying to do their own graphic design. It's 100% free, no registration required.

I have a huge SVG file that I filled with all the characters for a font. There are a lottt of characters and it'd take forever to manually copy each of them into its own file. Each character has all of its paths combined into a group, so if something could automatically put each group into its own SVG file, that would solve my problem. Any ideas? Thanks!

share|improve this question
Ability to do this would greatly depend upon the application being used to edit the svg files. You have not indicated any application in your question or tags. –  Scott Apr 25 '13 at 15:56
Oops sorry. I have Illustrator and Inkscape at my disposal. –  oxguy3 Apr 25 '13 at 15:58
add comment

2 Answers

One option is to use a data set, treating each glyph as a record. see for instance: ( http://vector.tutsplus.com/tutorials/tools-tips/quick-tip-data-driven-graphics-using-illustrators-variables-panel/ ) which is decent rundown where the author makes a single document with variables and a dataset and creates 100 unique business cards.

A second option is to notice that SVG files are text files and can be edited by a text editor. Exactly how you go about breaking the file up is dependent on how it was made and stored. I made a quick svg file by typing an 'a' glyph and then a 'b' glyph separately, expanded them, and then saved as svg. The result is below. Note the two <g> "fields."

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     width="612px" height="792px" viewBox="0 0 612 792" enable-background="new 0 0 612 792" xml:space="preserve">
    <path d="M104.219,114.458L103.379,117h-1.08l2.758-8.083h1.248l2.758,8.083h-1.115l-0.864-2.542H104.219z M106.881,113.642
    <path d="M97.912,134.036c0.456-0.108,1.187-0.18,1.907-0.18c1.043,0,1.715,0.18,2.207,0.588c0.419,0.312,0.684,0.792,0.684,1.427
        c-0.552,0.516-1.463,0.755-2.782,0.755c-0.72,0-1.271-0.048-1.619-0.096V134.036z M98.955,137.347h0.947
        c1.091,0,1.739-0.588,1.739-1.367c0-0.936-0.708-1.319-1.763-1.319c-0.48,0-0.755,0.036-0.923,0.072V137.347z M98.955,141.208

If I remove one whole <g></g> section and save a copy, revert, then remove the other section and save a second copy, the two files will each be a single glyph, preserving their original placement in the document frame.

Obviously this is pretty cumbersome, but it is amenable programmatic text editing (vbscript, php, applescript, grep, c etc)

share|improve this answer
add comment

I recently tried to put 26 glyphs on 26 artboards in Illustrator and export them separately. Turns out in Illustrator that's not possible with SVG; it only remembers the active artboard but keeps all of the art.

So, I just layered all of the glyphs on top of each other, hid all but one of them, and exported. Changed layer visibility and repeated.

I would imagine that an Illustrator script wouldn't be too hard here. Layer them all on one artboard, then run a script that would 1) hide all objects in the layer, 2) make the first group visible, 3) export as '1.svg', 4) hide active object, and then loop that for as many objects as you have.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.