fixed member image not being saved on first speech export
This commit is contained in:
parent
359d057a9b
commit
f3bf22f197
1 changed files with 9 additions and 3 deletions
|
@ -25,6 +25,7 @@ public class TeXUtil {
|
|||
private static String END_DOCUMENT = "\\end{document}";
|
||||
|
||||
public static String getSpeechToTexComponent(String speechId) {
|
||||
createTempDir();
|
||||
Speech speech = getSpeechByKey(speechId);
|
||||
|
||||
Logger.debug("Speech ID: " + speechId);
|
||||
|
@ -54,9 +55,7 @@ public class TeXUtil {
|
|||
public static String convertTexToBase64PDF(String tex) throws IOException, InterruptedException {
|
||||
// Create a temporary directory
|
||||
File tempDir = new File(TEMP_EXPORT_DIR);
|
||||
if (!tempDir.exists()) {
|
||||
tempDir.mkdir();
|
||||
}
|
||||
createTempDir();
|
||||
|
||||
// Format tex string to UTF-8
|
||||
tex = new String(tex.getBytes("UTF-8"));
|
||||
|
@ -98,6 +97,13 @@ public class TeXUtil {
|
|||
return Base64.getEncoder().encodeToString(pdfBytes);
|
||||
}
|
||||
|
||||
public static void createTempDir() {
|
||||
File tempDir = new File(TEMP_EXPORT_DIR);
|
||||
if (!tempDir.exists()) {
|
||||
tempDir.mkdirs();
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteTeXTempDirContents() throws IOException {
|
||||
// Walk through the directory
|
||||
Files.walkFileTree(Path.of(TEMP_EXPORT_DIR), new SimpleFileVisitor<Path>() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue