Last active
January 10, 2025 13:57
Convert LaTeX to PNG in Python. For more details: https://kb.aspose.com/tex/python/convert-latex-to-png-in-python/
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
import aspose.tex as tex | |
import os | |
from aspose.tex import * | |
from aspose.tex.io import * | |
from aspose.tex.presentation.image import * | |
path = "C://" | |
# Create the stream | |
with open(os.path.join(path, "any-name.png"), "wb") as png_stream: | |
# Create conversion options | |
options = TeXOptions.console_app_options(TeXConfig.object_latex) | |
# Specify the directory | |
options.output_working_directory = OutputFileSystemDirectory(path) | |
# Create PngSaveOptions object | |
options.save_options = PngSaveOptions() | |
# Save output PNG | |
TeXJob(os.path.join(path, "hello-world.ltx"), ImageDevice(True), options).run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment