Commit 2b8b3268 authored by 赵啸非's avatar 赵啸非

修改热门词汇

parent 7f67592b
Pipeline #2471 canceled with stages
......@@ -14,6 +14,7 @@ import com.mortals.framework.util.DateUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
......@@ -26,7 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@CommonsLog
@Slf4j
public class WordUtil {
private Configuration configure = null;
......@@ -77,7 +78,7 @@ public class WordUtil {
public static String convertWordToJPEG(String inputFile, String jpegPath) {
try {
log.info(String.format("word to jpg文件转换开始:%s", DateUtils.getCurrStrDateTime()));
log.info("word to jpg文件转换开始,inputFile:{},jepgPath:{}:{}", inputFile, jpegPath, DateUtils.getCurrStrDateTime());
// 转换开始前时间
long old = System.currentTimeMillis();
// 新建的PDF文件路径
......@@ -85,10 +86,8 @@ public class WordUtil {
//FileOutputStream os = new FileOutputStream(file);
// 要转换的word文档的路径
Document doc = new Document(inputFile);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF, EPUB, XPS, SWF 相互转换
//doc.save(os, SaveFormat.JPEG);
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.JPEG);
options.setPrettyFormat(true);
options.setUseAntiAliasing(true);
......@@ -104,10 +103,12 @@ public class WordUtil {
}
BufferedImage mergeImage = mergeImage(false, imageList);
ImageIO.write(mergeImage, "png", file);
ImageIO.write(mergeImage, "jpg", file);
// 转换结束后时间
/* doc.save(jpegPath);*/
doc.cleanup();
long now = System.currentTimeMillis();
//os.close();
log.info("文件转换结束,共耗时:" + ((now - old) / 1000.0) + "秒");
return jpegPath;
} catch (Exception e) {
......@@ -234,11 +235,12 @@ public class WordUtil {
}
public static void main(String[] args) {
/* String docPath = "E:\\pic\\doc\\附件1-四川省危险废物经营许可证申请表(补办)空白.docx";
String docPath = "E:\\pic\\doc\\2.docx";
String pdfPath = "E:\\pic\\pdf\\附件1-四川省危险废物经营许可证申请表(补办)空白.jpg";
String jpgPath = "E:\\pic\\doc\\2.jpg";
WordUtil.convertWordToJPEG(docPath, jpgPath);*/
WordUtil.convertWordToJPEG(docPath, jpgPath);
/*
String pdfPath = "E:\\pic\\pdf\\1.pdf";
......@@ -246,6 +248,7 @@ public class WordUtil {
WordUtil.pdfToImages(pdfPath, jpgPath);
*/
}
......
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