From 3ac0b7f54a4a3d747ff43eb9e7ca619e5ef0f8d0 Mon Sep 17 00:00:00 2001
From: zhijie <1003392067@qq.com>
Date: 星期日, 22 十月 2023 23:44:41 +0800
Subject: [PATCH] bugfix

---
 src/main/java/com/ots/project/tool/PdfUtil.java |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/main/java/com/ots/project/tool/PdfUtil.java b/src/main/java/com/ots/project/tool/PdfUtil.java
index 1941a78..20b8711 100644
--- a/src/main/java/com/ots/project/tool/PdfUtil.java
+++ b/src/main/java/com/ots/project/tool/PdfUtil.java
@@ -5,6 +5,7 @@
 
 import java.io.*;
 import java.lang.reflect.Constructor;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -47,24 +48,20 @@
     }
 
     /**
-     * 鎵цpython鑴氭湰 docx杞琾df
-     * @param filePath
+     * docker word杞琾df
+     * @param profile
+     * @param docx2pdfPath
+     * @param fileName
      */
-    public static void convertPythonPDF(String pythonScript,String filePath){
+    public static void dockerConvertPDF(String profile,String docx2pdfPath,String fileName){
         try {
-            File file = new File(filePath);
-            if(!file.exists()){
-                file.mkdirs();
-            }
-            //鎵嬪姩鏇挎崲杈撳嚭pdf鍚嶇О
-            String output = filePath.replaceAll(".docx", ".pdf");
-            String[] args1 = new String[] { "python3", pythonScript, filePath, output };
-            // 鎵цpy鏂囦欢
-            Process proc = Runtime.getRuntime().exec(args1);
+            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("python鎵ц鍛戒护:{}", Arrays.toString(args1));
-            log.info("python鎵ц杩斿洖");
+            log.info("docker鎵ц鍛戒护:{}", command);
+            log.info("docker鎵ц杩斿洖");
             while ((line = in.readLine()) != null) {
                 log.info(line);
             }

--
Gitblit v1.9.1