调整代码

This commit is contained in:
2025-07-01 16:31:48 +08:00
parent 0b34349a44
commit 7abd81ba1c

View File

@@ -44,6 +44,9 @@ public class DocumentConverter {
// 生成的word转为图片 // 生成的word转为图片
byte[] wordedToImage = documentService.wordToImage(generatedWord, "jpg"); byte[] wordedToImage = documentService.wordToImage(generatedWord, "jpg");
File imageFile = new File(targetFile.getAbsolutePath().replace(".pdf", ".jpg")); File imageFile = new File(targetFile.getAbsolutePath().replace(".pdf", ".jpg"));
if (imageFile.exists()) {
imageFile.delete();
}
Path imagePath = imageFile.toPath(); Path imagePath = imageFile.toPath();
Files.write(imagePath, wordedToImage); Files.write(imagePath, wordedToImage);
} }