You can read all the details at: Create Custom TeX (LaTeX) Format and Typeset to PDF, XPS in Java
Last active
December 23, 2021 07:05
-
-
Save aspose-com-gists/0612bbb4c8859ca06406cec4513759ea to your computer and use it in GitHub Desktop.
Create Custom TeX (LaTeX) Format and Typeset or Convert to PDF, XPS in Java
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
String dataDir = "D://Test//"; | |
// Create typesetting options for no format on ObjectTeX engine extension. | |
TeXOptions options = TeXOptions.consoleAppOptions(TeXConfig.objectIniTeX()); | |
// Specify a file system working directory for input. | |
options.setInputWorkingDirectory(new InputFileSystemDirectory(dataDir)); | |
// Specify a file system working directory for output. | |
options.setOutputWorkingDirectory(new OutputFileSystemDirectory(dataDir)); | |
// Run format creation. | |
TeXJob.createFormat("customtex", options); |
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
String dataDir = "D://Test//"; | |
// Create a file system input working directory. | |
IInputWorkingDirectory wd = new InputFileSystemDirectory(dataDir); | |
// Create a format provider. | |
final FormatProvider formatProvider = new FormatProvider(wd, "customtex"); | |
try { | |
// Create typesetting options for a custom format on ObjectTeX engine extension. | |
TeXOptions options = TeXOptions.consoleAppOptions(TeXConfig.objectTeX(formatProvider)); | |
options.setJobName("typeset-with-custom-format"); | |
// Specify the input working directory. | |
options.setInputWorkingDirectory(wd); | |
// Specify a file system working directory for output. | |
options.setOutputWorkingDirectory(new OutputFileSystemDirectory(dataDir)); | |
// Set PdfSaveOptions | |
options.setSaveOptions(new PdfSaveOptions()); | |
// Run typesetting. | |
new TeXJob(new ByteArrayInputStream( | |
"Congratulations! You have successfully typeset this text with your own TeX format!\\end".getBytes("ASCII")), new PdfDevice(), options); | |
} finally { | |
formatProvider.close(); | |
} |
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
String dataDir = "D://Test//"; | |
// Create a file system input working directory. | |
IInputWorkingDirectory wd = new InputFileSystemDirectory(dataDir); | |
// Create a format provider. | |
final FormatProvider formatProvider = new FormatProvider(wd, "customtex"); | |
try { | |
// Create typesetting options for a custom format on ObjectTeX engine extension. | |
TeXOptions options = TeXOptions.consoleAppOptions(TeXConfig.objectTeX(formatProvider)); | |
options.setJobName("typeset-with-custom-format"); | |
// Specify the input working directory. | |
options.setInputWorkingDirectory(wd); | |
// Specify a file system working directory for output. | |
options.setOutputWorkingDirectory(new OutputFileSystemDirectory(dataDir)); | |
// Run typesetting. | |
new TeXJob(new ByteArrayInputStream( | |
"Congratulations! You have successfully typeset this text with your own TeX format!\\end".getBytes("ASCII")), new rendering.XpsDevice(), options); | |
} finally { | |
formatProvider.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment