用com.aspose.words.Document.save方法将word转为pdf之后表格内文字上移-Java-CSDN问答

用com.aspose.words.Document.save方法将word转为pdf之后表格内文字上移。
这是转之后的pdf:图片说明

这是转之前的word:
图片说明
其他内容都是正常的只有表格的内容错乱了,这是怎么回事,有遇到过的吗
这是转换的代码

public static void doc2pdf(String inPath, String outPath) {        // 验证License 若不验证则转化出的pdf文档会有水印产生        if (!getLicense()) {            return;        }        try {            long old = System.currentTimeMillis();            // 新建一个空白pdf文档            File file = new File(outPath);            FileOutputStream os = new FileOutputStream(file);            // Address是将要被转化的word文档            Document doc = new Document(inPath);            // 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF, EPUB, XPS, SWF 相互转换            doc.save(os, SaveFormat.PDF);            long now = System.currentTimeMillis();            System.out.println(outPath+"生成共耗时:" + ((now - old) / 1000.0) + "秒");        } catch (Exception e) {            e.printStackTrace();            throw new BDException("word转pdf失败");        }    }

只有表格内的中文会向上移动一点,英文和符号数字正常的


原网址: 访问
创建于: 2023-05-09 20:23:15
目录: default
标签: 无

请先后发表评论
  • 最新评论
  • 总共0条评论