使用aspose.word 25.6版本将word转为pdf时
word中按中文习惯控制首尾字符,标点在最后时会压缩在同一行,转为PDF后标点符号换行
效果如下图所示:
word文件如下:
中文习惯转pdf多一行.docx (66.8 KB)
使用aspose.word 25.6版本将word转为pdf时
word中按中文习惯控制首尾字符,标点在最后时会压缩在同一行,转为PDF后标点符号换行
效果如下图所示:
Cause
The issue you’re experiencing, where a line appears in the PDF after converting from Word, is likely due to how Aspose.Words handles text positioning and formatting during the conversion process. This can occur when the text layout in Word does not translate perfectly to the PDF format, particularly with certain characters or punctuation.
Solution
To resolve this, you should enable additional text positioning when saving the document to PDF. This option can enhance the accuracy of text placement and may eliminate the issue with the extra line appearing.
Code
Here’s a code snippet to demonstrate how to enable this option when saving your document:
// Load the document
Document doc = new Document("path/to/your/document.docx");
// Create PdfSaveOptions and enable additional text positioning
PdfSaveOptions options = new PdfSaveOptions();
options.setAdditionalTextPositioning(true);
// Save the document as PDF
doc.save("path/to/output/document.pdf", options);
Next Steps
Please let me know if you need further assistance!
根据上述代码测试还是存在该问题
有问题的word已经提供,
请帮忙分析解决