| | |
| | | } |
| | | //手动替换输出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")); |