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时,段落中间若有——或短横线-,符号后会莫名加一个换行符 #92

Closed ThunderMaking closed 1 year ago

ThunderMaking commented 1 year ago

image 下图为pdf显示 image ### 使用最新aspose-word 22.9版本

AlexNosk commented 1 year ago

@ThunderMaking 您能否在此处附上您的输入和输出文档以进行测试? 我们将检查问题并为您提供更多信息。

ThunderMaking commented 1 year ago

test.docx

ThunderMaking commented 1 year ago

Test_out.pdf

AlexNosk commented 1 year ago

@ThunderMaking 感谢您提供更多信息。 我无法使用最新的 22.10 版本的 Aspose.Words for Java 重现我这边的问题。 这是使用以下代码在我这边生成的 hte 输出 PDF 文档:

Document doc = new Document("C:\\Temp\\in.docx");
doc.save("C:\\Temp\\out.pdf");

out.pdf

kingxjs commented 8 months ago

用其他第三方组件保存word,不要使用Aspose.Words的,否则转pdf是会出现这种情况,至少我使用 23.01 还是这个情况 。

我的情况是html转pdf,一直是横线后面会换行,当时想着先转word,确认word里面是否有换行,这时是没有换行的,但后面使用word转pdf就换行了

一次偶然打开word编辑又保存了一下,再转pdf就没有换行了

我是用poi先创建空白word,加载word进行html转pdf:

com.aspose.words.Document doc = new com.aspose.words.Document(wordPath);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertHtml(htmlContent);
doc.save(pdfPath, SaveFormat.PDF);
AlexNosk commented 8 months ago

@kingxjs 您能否附上您的输入 HTML 以及当前和预期的输出 PDF 文档? 我们将检查该问题并为您提供更多信息。 请注意,Aspose.Words 设计用于处理 MS Word 文档。 HTML 文档和 MS Word 文档对象模型有很大不同,将一种格式转换为另一种格式后并不总是能够提供 100% 的保真度。 在大多数情况下,Aspose.Words 在处理 HTML 文档时会模仿 MS Word 的行为。