whycxzp
2022-12-07 00e4715a062585ad8e4f9dbaea8910b06e8ff228
src/main/java/com/whyc/util/Word2PdfAsposeUtil.java
@@ -27,9 +27,9 @@
    }
    public static boolean doc2pdf(String inPath, String outPath) {
        /*if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
        if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
            return false;
        }*/
        }
        FileOutputStream os = null;
        try {
            File file = new File(outPath); // 新建一个空白pdf文档
@@ -52,7 +52,7 @@
        return true;
    }
    public static boolean doc2pdfWithWaterMark(String inPath, String outPath) {
    public static boolean doc2pdfWithWaterMark(String inPath, String outPath,boolean markable) {
        if (!getLicense()) { // 验证License 若不验证则转化出的pdf文档会有水印产生
            return false;
        }
@@ -61,7 +61,9 @@
            File file = new File(outPath); // 新建一个空白pdf文档
            os = new FileOutputStream(file);
            Document doc = new Document(inPath); // Address是将要被转化的word文档
            if(markable) {
            insertWaterMark(doc,"无效签名");
            }
            doc.save(os, SaveFormat.PDF);// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
        } catch (Exception e) {
            e.printStackTrace();
@@ -137,7 +139,7 @@
    public static void main(String[] args) {
        doc2pdfWithWaterMark("C:\\Users\\29550\\Desktop\\当前项目\\202207图纸管理\\流程卡和SOP的doc审批注入\\新FBI系列流程卡签字2.doc",
                "C:\\Users\\29550\\Desktop\\当前项目\\202207图纸管理\\流程卡和SOP的doc审批注入\\新FBI系列流程卡签字2-doc.pdf");
                "C:\\Users\\29550\\Desktop\\当前项目\\202207图纸管理\\流程卡和SOP的doc审批注入\\新FBI系列流程卡签字2-doc.pdf",true);
    }
}