aspose-words / Aspose.Words-for-Java

Aspose.Words for Java examples, plugins and showcases
https://products.aspose.com/words/java
MIT License
401 stars 206 forks source link

word转pdf后行距增加 #95

Closed ggxinyan closed 1 year ago

ggxinyan commented 1 year ago

我在windows上word转pdf正常。mac上word转pdf行距增加很多,导致文档页数增多

File file = new File(pdfPath);
FileOutputStream os = new FileOutputStream(file);
//Address是将要被转化的word文档
com.aspose.words.Document doc = new Document(wordPath);
//全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF, EPUB, XPS, SWF 相互转换
doc.save(os, SaveFormat.PDF);
os.close();

使用版本22.5

AlexNosk commented 1 year ago

@xiaohuocai-hz 出现此问题的原因可能是原始文档中使用的字体在执行文档转换的环境中不可用。 要构建文档布局 Aspose.Words 需要字体。 如果 Aspose.Words 找不到文档中使用的字体,则将 字体替换为。这可能导致字体不匹配和文档布局差异,从而导致返回错误的页码。 您可以实现 IWarningCallback 以在执行字体替换时获取通知。

ggxinyan commented 1 year ago

根据您指导的方向,我又去看了其字体替换行为。通过在mac和应用服务器(linux)安装windows的Fonts,能够解决行距增加问题。