Commit 6a7130f1 authored by hongguangwu's avatar hongguangwu

MVP1.7.11-是否自动生成解除劳动合同书 0否1是

parent f0a54cb9
......@@ -106,13 +106,13 @@ public class WordToImageUtil {
}
// 在生产环境中,建议在整个应用生命周期中共享一个OfficeManager:
public static OfficeManager OFFICE_MANAGER;
static {
OFFICE_MANAGER = LocalOfficeManager.builder()
public OfficeManager officeManager;
public void initOfficeManager() {
this.officeManager = LocalOfficeManager.builder()
.portNumbers(2003)
.build();
try {
OFFICE_MANAGER.start();
officeManager.start();
} catch (OfficeException e) {
e.printStackTrace();
}
......@@ -124,13 +124,14 @@ public class WordToImageUtil {
File pdfFile = null;
File imgFile = null;
try {
initOfficeManager();
// Step 1: Word 转为 PDF(中间格式)
pdfFile = new File(inputDocx.replace(".docx", ".pdf"));
Map<String, Object> pdfProps = new HashMap<>();
pdfProps.put("FilterName", "writer_pdf_Export");
pdfProps.put("SelectPdfVersion", 1); // PDF/A-1
LocalConverter.builder()
.officeManager(OFFICE_MANAGER)
.officeManager(officeManager)
.storeProperties(pdfProps)
.build()
.convert(new File(inputDocx))
......
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