MS Word document converted to less number of pages

I am using Aspose to convert Word documents to pdf. In some of the documents the number of pages is less than actual document. Upon inspection I noticed that the page breaks in source documents are different than pdf. There are no manual page breaks, just a continuous document but in source if a table is staring from next page due to less space at the end of page, in pdf it starts from the same page (e.g. two rows in the same page and rest of the table on next page). So in a way it decides itself how to adjust pages. Is there an option that it follows the page structure exactly as in source document?

@MujtabaHassan The problem might occur because the fonts used in your original document are not available in the environment where document conversion is performed. To build document layout Aspose.Words needs the fonts used in the document. If Aspose.Words cannot find the font used in the document, the font is substituted. This might lead into fonts mismatch and document layout differences and as a result incorrect page number returned. You can implement IWarningCallback to get notifications when font substitution is performed.

If the problem still persist on your side, please attach your input document here for testing. We will check the issue and provide you more information.

Hi, Arial font is used throughout the document, just the size of different sections is different but the font is same. It’s a 50+ pages document. As it is a document with company internal information so I have asked for permission if it can be shared externally. Will keep you updated.
Moreover following code I have tested with different combination of settings but nothing worked.

internal static Stream SaveAsPDF(Aspose.Words.Document doc)
{
    MemoryStream stream = new MemoryStream();
    // init font settings
    //LoadOptions loadOptions = new LoadOptions();
    //loadOptions.FontSettings = fontSettings;
    var options = new Aspose.Words.Saving.PdfSaveOptions()
    {
        SaveFormat = Aspose.Words.SaveFormat.Pdf,
        Compliance = Aspose.Words.Saving.PdfCompliance.Pdf17,
        EmbedFullFonts = true,
        OptimizeOutput = false,
        PreserveFormFields = true,
        PrettyFormat = true,
        UseCoreFonts = true,
        //UseHighQualityRendering = true,
        //ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto,
        FontEmbeddingMode = Aspose.Words.Saving.PdfFontEmbeddingMode.EmbedAll,
    };
    //doc.Save(stream, SaveFormat.Pdf);
    doc.Save(stream, options);
    return stream;
}

@MujtabaHassan Unfortunately, it is difficult to say what the problem is without your document. Once we get the problematic document, we will check it and provide you more information.

Hi, Finally I have a file that I can share. Attached word is the file and pdf was generated using Aspose, and you can see the difference.MelTEST.docx (136.7 KB)
MelTEST.pdf (149.2 KB)

@MujtabaHassan Thank you for additional information. I have managed to reproduce the problem on my side. For a sake of correction it has been logged as WORDSNET-24623. We will keep you informed and let you know once it is resolved.

Hi, Any update on this one?

@MujtabaHassan The issue occurs because footer text wrapping around floating table is not supported by Aspose.Words layout. The issue is postponed until this feature is implemented. Unfortunately, at the moment we cannot provide you a reliable estimate regarding it. We already started work on this feature, but since MS Word behavior is not documented and is not always obvious it is difficult to predict how long the work might take…

@MujtabaHassan Facing the same problems as you
https://forum.aspose.com/t/word-to-pdf-the-font-has-changed/255232

@Gao_Xingang Your document also contains a floating object in the header, so the issues might be related. Let’s continue discussion in the original thread.

The issues you have found earlier (filed as WORDSNET-24623) have been fixed in this Aspose.Words for .NET 23.5 update also available on NuGet.