Vector images and the DITA Open Toolkit
Rendering vector images (such as line art or charts) for PDF output through the DITA Open Toolkit can be tricky. You would think that an exported GIF of a vector image would display beautifully in the PDF—but you would be wrong.
When GIFs or other formats look too fuzzy, SVG files are an option for displaying vector images in DITA content with clarity. However, SVGs present their own challenge: the DITA OT may not preserve the font, size, or style of text from the original image. After some trial and error with both the OT and Adobe Illustrator, I finally stumbled across the settings that will solve this fonts issue.
To create an SVG image that will retain its original look in PDF output from the DITA OT:
- Open the Illustrator (.ai) file you used to create the image.
- Select the File menu, then Save As.
- Type a file name, then select SVG(*.SVG) from the drop-down list.
- Select the Save button. The SVG Options window is displayed.
- Under the Fonts section, select SVG from the Type drop-down list and All Glyphs from the Subsetting drop-down list. Leave the default settings for everything else in the window.
- Select the OK button.
A few more points to keep in mind:
- An SVG file can be created from an Illustrator file (.ai), an Illustrator EPS file (.eps), or an Illustrator template file (.ait).
- An SVG file cannot be created from an exported image file (such as a GIF, PNG, or JPEG), as this will not preserve clarity.
Take a look at the images below to see the difference in the way GIFs and SVGs are displayed.
Nancy Thompson
We always convert fonts to outline in Illustrator before saving the file to SVG so we don’t have any issues with missing fonts. We also make sure to select the option to Preserve Illustrator Editing Capabilities so we can go back and edit the SVG in Illustrator, if necessary.
Ryan
Thanks a lot for sharing. Can I create an SVG file from a PSD file?
Gretyl Kinsey
You’re welcome. You can import a PSD file into Illustrator, then save it as an SVG file. However, PSD files contain bitmap images rather than vector images, so they will not be truly scalable like vector images created in Illustrator and saved as SVGs.
Cyril Anderson
Hi. Sorry to pose a question on an article from AGES ago. So I’m wondering how that works together with localization. One of the other benefits of svg images is that the text items are easily extracted and translated by a localization services provider. But a challenge is that other languages will use exotic unicode characters. For example accented characters. When you choose “All Glyphs” from the Subsetting drop-down list in Illustrator, is this in theory pulling in multilingual glyphs as well?
Gretyl Kinsey
Hi Cyril, thank you for your question. The “All Glyphs” subsetting captures all of the glyphs in use in the Illustrator file. You may need to reapply fonts and choose that subsetting again after translation depending on your language and font needs. I hope that helps!