Aspose.word for java将word转为PDF时候,允许西文单词换行无效,在PDF中单词依旧是分开的

aspose.word for java将word转为PDF时候,允许西文单词换行无效,在PDF中单词依旧是分开的。
在word文件中是设置了允许西文单词中换行的。word文件:
unit_副本.docx (38.1 KB)

但是转换的PDF依旧是单词分开换行的,间距被拉大,导致很丑。转换后的PDF文件:
word.pdf (30.3 KB)
如图:
PDF.jpg (179.8 KB)

我要怎么做才能让这个word转为PDF之后依旧是西文单词换行的?
代码如下:

Document document = new Document(file.getInputStream());
document.save("./word.pdf", SaveFormat.PDF);

@pizhai2

在使用Aspose.Words for Java将Word文档转换为PDF时,如果您希望西文单词能够在换行时保持连贯,而不是分开,您可以尝试以下方法:

  1. 设置PDF保存选项:在保存文档为PDF时,您可以使用PdfSaveOptions类来配置一些选项。特别是,您可以设置setEmbedFullFonts(true),这将确保PDF中嵌入完整的字体,从而可能改善文本的显示效果。

  2. 示例代码

    Document document = new Document(file.getInputStream());
    PdfSaveOptions options = new PdfSaveOptions();
    options.setEmbedFullFonts(true); // 确保嵌入完整字体
    document.save("./word.pdf", options);
    
  3. 检查Word文档设置:确保在Word文档中,您已经正确设置了允许西文单词换行的选项。您可以在Word的段落设置中找到相关选项。

通过以上步骤,您应该能够改善转换后的PDF中西文单词的换行效果。如果问题仍然存在,建议检查Word文档的格式设置,确保没有其他影响文本布局的因素。

如果您有进一步的问题或需要更多帮助,请随时询问!

转人工核查该word的转化效果

@pizhai2
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28235

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.