Hi,
i want to convert a word document into a PDF document.
When converting test file “Test OK.docm” to PDF document, everything seems to be fine. The table on first page will not be moved.
When converting test file “Test FAIL.docm” to PDF document, the table on first page will be moved to second page. We did not expect this.
Main difference between both files is the text box on right side of first page of file “Test FAIL.docm”.
I have tested this szenario with latest library of Aspose.Word 25.3 Test OK.zip (134.7 KB)
It seems that the issue you are experiencing with the table moving to the next page during the conversion of your Word document to PDF may be related to the layout and positioning of elements within the document, particularly the text box on the right side of the first page in “Test FAIL.docm”.
Here are a few suggestions to help you avoid this issue:
Check Text Box Properties: Ensure that the text box does not have properties that could affect the layout of the table. For instance, check if the text box is set to “float” or if it has any margins that might push the table down.
Adjust Table Properties: You can try adjusting the properties of the table itself. Make sure that the table is set to not allow page breaks within it. This can often be done in the Word document by selecting the table, going to the table properties, and ensuring that the “Allow row to break across pages” option is unchecked.
Use PdfSaveOptions: When saving the document to PDF, you can use PdfSaveOptions to control various aspects of the conversion. For example, you might want to set options that affect how the layout is handled during conversion. Here’s a sample code snippet to illustrate how to use PdfSaveOptions:
using Aspose.Words;
using Aspose.Words.Saving;
string path = "c:\\Test\\";
Document documentFail = new Document(path + "Test FAIL.docm");
PdfSaveOptions saveOptions = new PdfSaveOptions
{
// Set any specific options you need here
// For example, you can set compliance level
Compliance = PdfCompliance.Pdf17
};
documentFail.Save(path + "Test FAIL.pdf", saveOptions);
Test with Different Layouts: If possible, try modifying the layout of the “Test FAIL.docm” document by moving the text box or adjusting its size to see if that resolves the issue.
Update Aspose.Words: Ensure that you are using the latest version of Aspose.Words, as updates may include fixes for layout issues during conversion.
If these suggestions do not resolve the issue, consider sharing the specific properties of the text box and table, as well as any additional layout settings that might be affecting the conversion. This information could help in diagnosing the problem further.
Feel free to reach out if you have any more questions or need further assistance!
@curmas I cannot reproduce the problem on my side. Here are PDF documents produced on my side
MS Word: ms.pdf (120.7 KB)
Aspose.Words: out.pdf (87.8 KB)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.