/** * 将doc转换为pdf * * @param docAbsolutedPath 传入word绝对路径 * @param pdfAbsolutedPath 传入生成的pdf绝对路径 * @return */ public String convertWordToPdf(String docAbsolutedPath, String pdfAbsolutedPath) { boolean suc = true; Document document = null; try { document = new Document(docAbsolutedPath); // 增加,测试字体转换时报错的情况,20200406 FontSettings fontSettings = new FontSettings(); // fontSettings.setFontsFolder("C:\\Users\\a\\Desktop\\字体", true); IWarningCallback callback = info -> { // We are only interested in fonts being substituted. if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) { System.out.println("Font substitution: " + info.getDescription()); } }; document.setWarningCal
java实现word文档转为pdf文件
最新推荐文章于 2024-04-10 13:24:07 发布