| | |
| | | } |
| | | |
| | | 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文档 |
| | |
| | | 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; |
| | | } |
| | |
| | | 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(); |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |
| | | |