From fb2ee921d9b3ae8c82a004a2f72b7f71713b8e0c Mon Sep 17 00:00:00 2001
From: zhijie <1003392067@qq.com>
Date: 星期二, 01 六月 2021 22:31:48 +0800
Subject: [PATCH] 代码注释添加

---
 src/main/java/com/ots/project/tool/ShellTool.java |   35 +++--------------------------------
 1 files changed, 3 insertions(+), 32 deletions(-)

diff --git a/src/main/java/com/ots/project/tool/ShellTool.java b/src/main/java/com/ots/project/tool/ShellTool.java
index 715583b..de464dd 100644
--- a/src/main/java/com/ots/project/tool/ShellTool.java
+++ b/src/main/java/com/ots/project/tool/ShellTool.java
@@ -15,8 +15,7 @@
         } else {
             builder.append("libreoffice6.4 --headless --convert-to ");
         }
-
-        builder.append(type).append(" ");
+        builder.append(type).append(":impress_pdf_Export ");
         builder.append("--outdir " + targetPath).append(" ");
         builder.append(sourcePath).append(" ");
         
@@ -27,36 +26,8 @@
             }
         } catch (Exception e) {
         }
-        return run_cmd(builder.toString());
+        return exec(builder.toString());
     }
-
-    public static String run_cmd(String strcmd) {
-        //
-        Runtime rt = Runtime.getRuntime(); //Runtime.getRuntime()杩斿洖褰撳墠搴旂敤绋嬪簭鐨凴untime瀵硅薄
-        Process ps = null;  //Process鍙互鎺у埗璇ュ瓙杩涚▼鐨勬墽琛屾垨鑾峰彇璇ュ瓙杩涚▼鐨勪俊鎭��
-        try {
-            ps = rt.exec(strcmd);   //璇ュ璞$殑exec()鏂规硶鎸囩ずJava铏氭嫙鏈哄垱寤轰竴涓瓙杩涚▼鎵ц鎸囧畾鐨勫彲鎵ц绋嬪簭锛屽苟杩斿洖涓庤瀛愯繘绋嬪搴旂殑Process瀵硅薄瀹炰緥銆�
-            ps.waitFor();  //绛夊緟瀛愯繘绋嬪畬鎴愬啀寰�涓嬫墽琛屻��
-        } catch (IOException e1) {
-            e1.printStackTrace();
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-        int i = ps.exitValue();  //鎺ユ敹鎵ц瀹屾瘯鐨勮繑鍥炲��
-        if (i == 0) {
-            System.out.println("鎵ц瀹屾垚.");
-        } else {
-            System.out.println("鎵ц澶辫触.");
-        }
-
-        ps.destroy();  //閿�姣佸瓙杩涚▼
-        ps = null;
-
-        return null;
-    }
-
     private static String exec(String command) {
         String returnString = "";
         Runtime runTime = Runtime.getRuntime();
@@ -80,6 +51,6 @@
         return returnString;
     }
     public static void main(String[] args) {
-        System.out.println(exec("libreoffice6.4 --headless --convert-to  /root/灏忕孩.docx 灏忕孩.pdf "));
+        System.out.println(exec("soffice.exe --headless --invisible --convert-to  D:/ots/uploadPath/upload/2021/02/28/01e01cf7e372ba8b1c5d24b8d69a46f8.docx 01e01cf7e372ba8b1c5d24b8d69a46f8.pdf "));
     }
 }

--
Gitblit v1.9.1