Last active
December 15, 2023 06:32
-
-
Save conholdate-gists/0912a2cb283a46073c751a8727f9eb83 to your computer and use it in GitHub Desktop.
Convert LaTeX to Word in C# | TeX to DOCX in .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
// Create typesetting options for default ObjectTeX format. | |
TeXOptions options = TeXOptions.ConsoleAppOptions(Aspose.TeX.TeXConfig.ObjectTeX()); | |
// Specify a file system working directory for input. | |
options.InputWorkingDirectory = new InputFileSystemDirectory(dataDir); | |
// Specify a file system working directory for output. | |
options.OutputWorkingDirectory = new OutputFileSystemDirectory(dataDir); | |
// Specify memory stream as output terminal. | |
options.TerminalOut = new OutputMemoryTerminal(); | |
// Set options for rendering into PDF format. | |
options.SaveOptions = new PdfSaveOptions(); | |
// Run typesetting. | |
new Aspose.TeX.TeXJob("hello-world", new PdfDevice(), options); | |
// Instantiate DocSaveOptions object | |
DocSaveOptions DocOptions = new DocSaveOptions | |
{ | |
// Specify the output format as DOCX | |
Format = DocSaveOptions.DocFormat.DocX | |
}; | |
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "hello-world.pdf"); | |
doc.Save(dataDir + "hello-world.docx", DocOptions); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment