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

Free Support Forum - aspose.com

Preserve Paragraph's Keep with Next Property under Line and Page Breaks during DOCX to PDF Conversion using C# .NET

I think this may be broke again. I am experiencing the same(?) issue using v19.9.0. I can save a docx file as a PDF and it formats correctly, but when our code does that same docx file, I get a page break after the first line and the rest continues on a 2nd page. Please let me know if more info is needed. Thanks!!


Please upgrade to the latest version of Aspose.Words for .NET i.e. 19.12 and see how it goes on your end? Hope, this helps.

In case the problem still remains, please ZIP and upload your input Word document and Aspose.Words generated output file showing the undesired behavior here for testing. Please also provide a comparison screenshot highlighting the problematic areas in the Aspose.Words generated output file with respect to your original document and attach it here for our reference. We will then investigate the issue on our end and provide you more information.

KeepNextTestConsole.zip (2.2 MB)
Thanks for the assistance Awais, but there was no change in behavior when I updated to 19.12. Attached is a snippet of code I am using. Within the archive, there is a content folder that has examples.

final_fromWord_Ipsum.pdf :: This is the result I am expecting using aspose. I loaded the final_Ipsum.docx in Word and saved that as a PDF.

final_fromApsose_Ipsum.pdf :: This is the result of the code attached.

Notice at the very bottom of each PDF document the difference. Please let me know if you need any additional info.



We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19699. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

Thank you Awais! I eagerly look forward to this resolution.


Our initial analysis so far reveals that the problem occurs because Aspose.Words currently does not push the first line in a Section to satisfy Paragraph rules in compatibility mode. Sure, we will inform you via this thread as soon as this issue will be resolved in future.

Hi Awais. Do we have an estimate on when this fix will be released to production?



Your document contains four continuous sections on the page. For the first paragraph in the last section, the KeepWithNext rule is enabled.

MS Word pushes this paragraph to the next page to satisfy the rule. It seems that MS Word applies paragraph rules to the first paragraph in a continuous section if this section is not the first on the page.

Also, MS Word has the same behavior for the Widow/Orphan and KeepLinesTogether rules.

Unfortunately, Aspose.Words currently does not support this logic. The implementation of this issue has been postponed till a later date. There are no estimates (ETA) available at the moment. We will inform you via this thread as soon as this issue will be resolved in future. We apologize for your inconvenience.

A post was split to a new topic: Page contains continuous section, first para in section has “keep with next” and “keep with next” is not being enforced during Word save as PDF

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