LaTeX is used to create refined and polished scientific documents that can include complex math expressions, multilingual materials, etc. In certain scenarios, you might need to convert a TeX file to an SVG image. Following such requirements, this article explains how to convert TeX to SVG image programmatically in Java.
- TeX to SVG Image Converter – Java API Installation
- How to Convert LaTeX TeX to SVG in Java - Steps
- Convert LaTeX to SVG Image Programmatically in Java
TeX to SVG Image Converter – Java API Installation
Aspose.TeX for Java API supports typesetting the TeX files. Moreover, you can create a custom TeX format or render the LaTeX files to supported file formats. You can easily configure the API by downloading the JAR file from the Downloads section, or use the following specifications in pom.xml file to install it from the repository:
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>https://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-tex</artifactId> <version>22.8</version> </dependency>
How to Convert LaTeX TeX to SVG in Java - Steps
The following steps demonstrate how to convert a LaTeX format file to an SVG image:
- Create LaTeX conversion options upon Object TeX engine extension.
- Specify a working directory.
- Initialize the SvgSaveOptions object for rendering the SVG image.
- Run LaTeX to SVG image conversion.
Convert LaTeX to SVG Image Programmatically in Java
You need to follow the following steps to convert a LaTeX file to an SVG image:
- Create LaTeX conversion options using the TeXOptions class object.
- Specify the working directory to create the output file.
- Create an object of SvgSaveOptions class.
- Render the LaTeX to SVG format file using the TexJob class.
The following sample code demonstrates how to convert LaTeX to SVG image programmatically in Java:
Get Free Evaluation License
You can avoid evaluation limitations by requesting a free temporary license.
In this article, you have learned how to convert a LaTeX file to a scalable SVG image programmatically in Java. Moreover, you can explore the documentation space to take a look at other chapters which cover different features of the API. Please feel free to contact us at forum in case you need to discuss any requirements or concerns.