Created
July 8, 2024 08:47
-
-
Save aspose-com-gists/00f8f56b02360659a5d8fb0ca2db590f to your computer and use it in GitHub Desktop.
C# Library for LaTeX to XPS
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
using Aspose.TeX.IO; | |
using Aspose.TeX; | |
using Aspose.TeX.Presentation.Xps; | |
// Define the working directory. | |
string dataDir = "C:\\files\\"; | |
// Open a FileStream on the output path | |
using (Stream xpsStream = File.Open(Path.Combine(dataDir, "any-name.xps"), FileMode.Create)) | |
{ | |
// Create conversion options for Object LaTeX format upon Object TeX engine by calling the ConsoleAppOptions method. | |
TeXOptions options = TeXOptions.ConsoleAppOptions(TeXConfig.ObjectLaTeX); | |
// Specify a file system working directory for the output. | |
options.OutputWorkingDirectory = new OutputFileSystemDirectory(dataDir); | |
// Initialize an object of the XpsSaveOptions class for saving in XPS format. | |
options.SaveOptions = new XpsSaveOptions(); | |
// Create an instance of the XpsDevice class and initialize it with xpsStream. | |
XpsDevice xpsDevice = new XpsDevice(xpsStream); | |
// Run LaTeX to XPS conversion by invoking the TeXJob constructor. | |
new TeXJob(Path.Combine(dataDir, "sample.ltx"), xpsDevice, options).Run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment