dvisvgm is a utility for TeX/LaTeX users. It converts DVI, EPS, and PDF files to the XML-based scalable vector graphics format SVG. The latest releases support standard DVI files (version 2) as well as DVI output created by pTeX in vertical mode (version 3), and XeTeX (versions 5 to 7, also known as XDV).
To get an impression of the conversion results, have a look at the examples created with dvisvgm.
Short overview of the main features:
- Complete font support including virtual fonts, evaluation of font encodings, CMap files, sub-font definitions and font maps.
- Glyph outlines of all required fonts are embedded into the generated SVG files.
- The font data can be embedded in SVG, TrueType, WOFF, or WOFF2 format.
- Glyph outlines of fonts that are not available in a vector format are generated on-the-fly by vectorizing METAFONT's bitmap output.
- dvisvgm allows to replace font elements by paths so that applications without SVG font support are enabled to render dvisvgm's output properly.
- Computes tight bounding boxes for the generated graphics, but supports common paper formats and arbitrary user-defined sizes as well.
- Option
--eps
allows to convert EPS files to SVG. - Option
--pdf
allows to convert PDF documents to SVG. - Intersections of clipping paths can be computed directly instead of delegating this task to the SVG renderer which increases the compatibility of the generated SVG files.
- Approximates PostScript color gradient fills not directly supported by SVG 1.1.
- The generated SVG structure and data can be improved with the built-in SVG optimizer.
- Optionally creates compressed SVGZ files.
- Provides options for applying page transformations, like translation, rotation, scaling, and skewing.
- Evaluates several specials including color, emTeX, tpic, hyperref/HyperTeX, papersize, PDF hyperlink and mapfile, as well as PostScript specials.
- The converter was successfully tested on various Linux (TeX Live) and Windows (MiKTeX, TeX Live) systems.
- dvisvgm has been added to TeX Live, MiKTeX, and MacPorts. It is therefore available for a wide range of operating systems.
For detailed information about the command-line interface and all available options of dvisvgm, see the manual page.
dvisvgm relies on the following free libraries:
-
Clipper
To compute the intersection of two curved paths, dvisvgm flattens the paths to polygons, intersects them using a slightly modified version of Clipper, and reconstructs the curves afterwards. A slightly modified version of Clipper is bundled with the sources. -
FreeType 2
This library is used to extract the glyph outlines from vector fonts (PFB, OTF, TTF). -
Ghostscript
The PostScript special handler requires the Ghostscript shared librarylibgs.so.N
(Linux) orgsdll32.dll
/gsdll64.dll
(Windows) to be installed. If the configure script finds the corresponding Ghostscript development files on the system, it directly links againstlibgs.so.N
, where N is the library's ABI version. Otherwise, the library is looked up during runtime, and the PostScript support is enabled only if the shared library can be found. Due to incompatible changes of the Ghostscript API, dvisvgm requires Ghostscript 8.31 or later. -
Kpathsea
This library is part of the Web2C package and is usually installed in conjunction with a TeX distribution. Kpathsea provides functions for searching files in the largetexmf
tree. Please ensure that you use the kpathsea version coming with or matching your TeX system. -
potracelib
Peter Selinger's bitmap tracing library is utilized to vectorize Metafont's bitmap output. It's also bundled with the dvisvgm sources. -
ttfautohint
dvisvgm can optionally be built with ttfautohint support to allow for autohinting the generated TrueType, WOFF, and WOFF2 fonts. Since this is still an experimental feature, ttfautohint support is disabled by default. To enable it, runconfigure
with option--with-ttfautohint
. -
woff2 and brotli
These Google libraries are bundled with the dvisvgm sources. They are used to create WOFF2 files from TrueType fonts. -
xxHash
The xxHash library provides a fast hash algorithm. dvisvgm uses it to create unique integer values from PostScript character names in order to store them in a compact way together with their Unicode points. A recent version of xxHash is bundled with the dvisvgm sources. -
zlib
This library is required to create compressed SVGZ files.
dvisvgm is written in C++11 (ISO C++ standard 2011) and requires an appropriate compiler, like GCC 4.9, Clang 3.3, or any later version. The configure script checks for the availability of C++11 support and adds the proper compiler options if necessary.
Quick installation info:
- ensure that the development packages of all libraries, listed above, are installed
- type
autoreconf -fi
ifconfigure
is not present in the dvisvgm root folder - either type
./configure
if you don't want to use the bundled libraries brotli, potrace, woff2, and xxHash but link against the corresponding system libraries, - or type
./configure --enable-bundled-libs
in order to build and statically link the bundled libraries. - type
make
- type
make install
as root (orsudo make install
)
For generic configuration instructions see the file INSTALL.
The configure script should recognize all necessary parameters.
If a library is installed but not detected, specify its location
as command-line parameter of configure, e.g.
./configure --with-freetype=/usr/local/freetype
(all available options can be displayed with ./configure --help
)
The tracer module calls Metafont in case of lacking TFM or PFB files via a system call. Please ensure that Metafont is installed and reachable through the system's search path.
If you don't like compiling the sources yourself, you can download pre-compiled binaries for Windows and MiKTeX from the project website instead.
This package is available from CTAN, and can be downloaded from the project website as well. There you find the sources, pre-compiled binaries, the manual page, FAQs and further information about the converter and related topics.
If you've found a bug, please let me know. You can either send me an email or preferably use the bug tracker at GitHub.
Copyright © 2005–2023 Martin Gieseking
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.