| | |
| | | import com.aspose.words.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.FileOutputStream; |
| | | import java.io.*; |
| | | import java.lang.reflect.Constructor; |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | /** |
| | | * docker word转pdf |
| | | * @param profile |
| | | * @param docx2pdfPath |
| | | * @param fileName |
| | | */ |
| | | public static void dockerConvertPDF(String profile,String docx2pdfPath,String fileName){ |
| | | try { |
| | | String command = MessageFormat.format(docx2pdfPath,profile,fileName); |
| | | // 执行docker 命令 |
| | | Process proc = Runtime.getRuntime().exec(command); |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream(), "GBK")); |
| | | String line = null; |
| | | log.info("docker执行命令:{}", command); |
| | | log.info("docker执行返回"); |
| | | while ((line = in.readLine()) != null) { |
| | | log.info(line); |
| | | } |
| | | in.close(); |
| | | proc.waitFor(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * aspose-words:jdk17:23.4 版本 |
| | | */ |
| | | public static void registerWord() throws Exception { |