A TeX file may contain text, symbols, or arithmetic expressions. These are used for typesetting the documents and you can typeset TeX input to PDF, XPS, and several other supported formats. In this article, you will be learning how to convert LaTeX to PDF in C# programmatically. The following sections explain the topic in detail:
- LaTeX to PDF API Installation
- Convert LaTeX to PDF in C#
- TeX ZIP Directory to PDF ZIP Directory Conversion in C#
- LaTex to PDF Converter - Online Tool
- Convert LaTeX (TeX) to XPS File Programmatically in C#
LaTeX to PDF API Installation
Aspose.TeX for .NET API has been designed for typesetting TeX files to different file formats like PDF, XPS, or images. You can quickly configure the API by downloading the DLL file from the Downloads section, or you can install it from NuGet with the following installation command:
PM> Install-Package Aspose.TeX
Convert LaTeX to PDF in C#
You can convert TeX to PDF file with the steps below:
- Create typesetting options for default ObjectTeX format.
- Specify console or memory stream as an output terminal.
- Set options for rendering into PDF format.
- Call TexJob class constructor and save output PDF with PdfDevice class object.
The following code snippet explains how to convert TeX to PDF file programmatically using C#:
The arguments passed to the TexJob class constructor are noteworthy here. The first one refers to the path to the input TeX file, the second is Device type while the third one refers to TexOptions.
Convert TeX ZIP Directory to PDF ZIP Directory Conversion in C#
You may need to convert multiple TeX files to PDF at a time. In such cases, you may convert TeX file in a ZIP archive to PDF document in zipped form. You need to follow the steps below:
- Open streams on ZIP archives as the input and output working directory.
- Create typesetting options using the TeXOptions class object.
- Create and specify saving options with PdfSaveOptions.
- Run typesetting with TexJob class constructor.
The code below elaborates on how to convert TeX ZIP archive to PDF ZIP archive programmatically using C#:
LaTex to PDF Converter - Online Tool
This online LaTeX to PDF converter is powered by Aspose.TeX for .NET.
Convert TeX (LaTeX) to XPS File Programmatically in C#
You can convert TeX to XPS file with the following steps:
- Create typesetting options on ObjectTeX engine extension.
- Specify a file system working directory for input and output.
- Convert TeX to XPS by running Typesetting with XpsDevice.
The following code shows how to convert TeX file to XPS programmatically using C#:
Get Free API License
You can evaluate the API with full access by requesting a Free Temporary License.
Conclusion
In this article, you have explored how to convert LaTeX to PDF in C#. Moreover, you have also learned how to convert a TeX file into a ZIP archive and create an output ZIP directory. You can have a look at several other features by visiting the API Documentation. Please feel free to contact us at the Free Support Forum in case of any concerns.