whyclxw
2025-05-28 e16302f9d475c7cc4dd18c5abf1a23cb5502e362
src/main/java/com/whyc/util/Word2PdfJacobUtil.java
@@ -47,26 +47,14 @@
        } finally {
            Dispatch.call(doc, "Close", false);
            System.out.println("关闭文档");
            if (app != null)
                app.invoke("Quit", new Variant[] {});
            if (app != null) {
                app.invoke("Quit", new Variant[]{});
            }
            // 如果没有这句话,winword.exe进程将不会关闭
            ComThread.Release();
            ComThread.quitMainSTA();
        }
    }
    public static void main(String[] arg){
        //String docPath = "C:\\Users\\29550\\Desktop\\研发人员考核方案.docx";
        String docPath = "http://118.89.139.230/zentao/data/upload/1/202205/1721233604702196";
        //String pdfPath = "C:\\Users\\29550\\Desktop\\研发人员考核方案2.pdf";
        String pdfPath = "F:\\pdf\\研发人员考核方案2.pdf";
        for (int i = 0; i < 20; i++) {
            boolean res = Word2PdfJacobUtil.word2PDF(docPath, pdfPath);
            System.out.println(res);
        }
    }
}