You can find more details at:Convert LaTeX to PNG or JPG Image in C#
Last active
December 29, 2021 19:36
Star
You must be signed in to star a gist
Convert LaTeX TeX LTX File to PNG JPG Image Programmatically in C# .NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input LTX or TEX file | |
byte[] bytes = File.ReadAllBytes("helloworld.ltx"); | |
Stream stream = new MemoryStream(bytes); | |
// Create conversion options for Object LaTeX format on Object TeX engine extension. | |
TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectLaTeX); | |
// Specify the file system working directory for the output. | |
options.OutputWorkingDirectory = new OutputFileSystemDirectory(dataDir); | |
// Initialize the options for saving in JPG format. | |
options.SaveOptions = new JpegSaveOptions(); | |
// Run LaTeX to JPG conversion. | |
new TeXJob(stream, new ImageDevice(), options).Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load the input LTX or TEX file | |
byte[] bytes = File.ReadAllBytes("helloworld.ltx"); | |
Stream stream = new MemoryStream(bytes); | |
// Create conversion options for Object LaTeX format on Object TeX engine extension. | |
TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectLaTeX); | |
// Specify the file system working directory for the output. | |
options.OutputWorkingDirectory = new OutputFileSystemDirectory(dataDir); | |
// Initialize PngSaveOptions for saving image in PNG format. | |
options.SaveOptions = new PngSaveOptions(); | |
// Run LaTeX to PNG conversion. | |
new TeXJob(stream, new ImageDevice(), options).Run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment