From 644fc2c4817d759195c016bcac80f43ec6540dfc Mon Sep 17 00:00:00 2001 From: 林致杰 <1003392067@qq.com> Date: 星期四, 19 十月 2023 18:40:53 +0800 Subject: [PATCH] bugfix --- src/main/java/com/ots/project/tool/PdfUtil.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 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..e7d60a2 100644 --- a/src/main/java/com/ots/project/tool/PdfUtil.java +++ b/src/main/java/com/ots/project/tool/PdfUtil.java @@ -58,7 +58,14 @@ } //鎵嬪姩鏇挎崲杈撳嚭pdf鍚嶇О String output = filePath.replaceAll(".docx", ".pdf"); - String[] args1 = new String[] { "python3", pythonScript, filePath, output }; + + String os = System.getProperty("os.name"); + String[] args1; + if (os.contains("Windows")){ + args1 = new String[] { "python", pythonScript, filePath, output }; + } else { + args1 = new String[] { "python3", pythonScript, filePath, output }; + } // 鎵цpy鏂囦欢 Process proc = Runtime.getRuntime().exec(args1); BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream(), "GBK")); -- Gitblit v1.9.1