Convert TeX to PNG JPG Image in C#

The TeX format is used for working with technical and scientific documents. It is often used to communicate or publish such documents. In certain situations, you might need to render TeX files to images like PNG or JPG. In this article, you will learn how to convert TeX to PNG or JPG images programmatically in C#. Please refer to the following sections for further details.

LTX/TeX to PNG or JPG Converter – C# API Installation

Aspose.TeX for .NET API supports working with TeX, PNG, JPG, and other supported formats. You can easily configure the API by downloading its DLL file from the Downloads section, or installing it from NuGet with the below installation command:

PM> Install-Package Aspose.TeX

Convert TeX (LaTeX) to PNG Image in C#

You can convert an LTX or TeX file to a PNG image with the following steps:

  1. Load the input LTX or TEX file.
  2. Create conversion options for LaTeX format with TeXOptions class.
  3. Initialize PngSaveOptions for saving image in PNG format.
  4. Run LaTeX to PNG conversion with TexJob class.

The code snippet below explains how to convert TeX to PNG file programmatically in C#:

Convert LTX or TeX to JPG Image using C#

You can convert a LaTeX file with LTX or TEX file extension, to a JPG image with the steps below:

  1. Load the source LaTeX file.
  2. Create options using the TeXOptions class object.
  3. Specify JpegSaveOptions class object.
  4. Run LaTeX to JPG using the TexJob class.

The following code elaborates how to convert TeX to JPG image programmatically using C#:

Get Free Evaluation License

You can evaluate the API without any limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to convert TeX files to PNG or JPG images programmatically in C#. You can embed the feature to convert LaTeX files with TEX or LTX file extension in your .NET or .NET Core based applications. Moreover, you can take a look at the documentation. Please feel free to reach out to us at the forum for any of your queries.

See Also