Commit b06cb4a0 authored by hongguangwu's avatar hongguangwu

1.7.21-薪资0申报

parent 263b0d4b
......@@ -152,6 +152,7 @@ public class WordToImageUtil {
int quality = 100; // 从100%开始
File compressedFile = new File(projectRoot, TO_IMAGE_TEMP);
int maxSize = 1024 * 1024;
try {
while (originalFile.length() > maxSize && quality > 10) {
quality -= 5;
ImageIO.write(image, "png", compressedFile);
......@@ -162,6 +163,11 @@ public class WordToImageUtil {
}
compressedFile.delete();
}
} catch (Exception e) {
if (compressedFile != null && compressedFile.exists()) {
compressedFile.delete();
}
}
return originalFile;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment