We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Keep Lines Together failing

Hi,

I’m using Words 13.10 (JDK 1.6) to convert a Word file to PDF. There’s a problem with keeping lines together in some places. I can’t see what’s causing it. In the attached Word file, there’s a paragraph on the last page that is only on the last page due to the “Keep Lines Together” flag. However, when it’s converted to PDF (also attached), this instruction is being lost and the paragraph is split over the last two pages.

I have also tried this with Words 14.8 which is the latest version we have a license for and the same problem exists. I’ve tried tweaking the paragraph several ways, removing the hanging text, etc to see if anything will fix it but nothing works. I searched the forums but can only find one reference to “keep together” failing and being fixed in Words version 2.

Any advice appreciated!

Thanks

Hi John,

Thanks for your inquiry. After an initial test with Aspose.Words 15.2.0, I was unable to reproduce this issue on my side (please see attached 15.2.0.pdf). I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link. I hope, this helps.
http://www.aspose.com/community/files/72/java-components/aspose.words-for-java/default.aspx

Best regards,

Hey there,

Thanks for the update, it’s appreciated. There is in fact another issue at play here. The PDF produced by versions 14.8.0 and 15.2.0 of Words appears to produce a different layout to the PDF produced by version 13.10. I don’t know why that is but you can compare the native Word file with the PDFs and see that the content ends up spread out on different pages. Words v13.10 is in my view the closest in accuracy to the native Word content, except for the single problem I describe above.

To ignore the formatting problems and replicate the problem above in 15.2.0, you would have to add additional content to the “C.01” paragraphs in order to push the “C.02” paragraph down to the point where it breaks over the page. It is only then that you can see whether it correctly “jumps” onto the next page or not. I’ve done this using version 14.8.0 and it still happens.

Thanks

Hi John,

Thanks for your inquiry. But, could you please attach your modified Word document you're getting this problem with during converting to PDF here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi,

I’ve attached an updated Word file that I believe will show the problem in the latest versions of Aspose Words. The paragraph on the last page beginning with “C.02” appears broken up over two pages in the PDF, despite not appearing this way in Word using the “keep lines together” flag. The PDF was generated using Aspose Document save method.

Thanks,

John

Hi John,

Thanks for your inquiry. While using the latest version of Aspose.Words i.e. 15.3.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-11712. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

Ok great, thanks for following up on it!


Regards,

John

The issues you have found earlier (filed as WORDSNET-11712) have been fixed in this Aspose.Words for .NET 20.4 update and this Aspose.Words for Java 20.4 update.