Word转pdf后多出一行

使用aspose.word 25.6版本将word转为pdf时
word中按中文习惯控制首尾字符,标点在最后时会压缩在同一行,转为PDF后标点符号换行
效果如下图所示:


word文件如下:
中文习惯转pdf多一行.docx (66.8 KB)

@Visionmc

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

  1. Implement the above code in your application.
  2. Test the output PDF to confirm if the issue with the extra line is resolved.
  3. If the problem persists, check the original Word document for any unusual formatting or hidden characters that might affect the conversion.

Please let me know if you need further assistance!

根据上述代码测试还是存在该问题
有问题的word已经提供,
请帮忙分析解决

@Visionmc 感谢您报告此问题。 我们已经在我们的内部问题跟踪系统中打开了以下新工单,并将根据 免费支持政策 中提到的条款提供它们的修复:

Issue ID(s): WORDSNET-28461

如果您需要优先支持以及直接联系我们的付费支持管理团队,您可以获得 付费支持服务