Word to PDF some images are moving to next page while converting

Hi Team,

I am trying to convert word to pdf using aspose.
While converting some images are moving to next page in the converted pdf, due to which the doc structure changed.

Can you please help on this?

I am using below code

public  bool WordToPdf(Aspose.Words.Document doc, string outPdfPath, out string errorMessage)
        {
            bool res = false;
            errorMessage = string.Empty;
            try
            {
                Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
                options.DmlRenderingMode = Aspose.Words.Saving.DmlRenderingMode.Fallback;
                options.UpdateFields = true;
                options.DmlEffectsRenderingMode = Aspose.Words.Saving.DmlEffectsRenderingMode.Simplified;
                // options.Compliance = Aspose.Words.Saving.PdfCompliance.PdfA1b;
                options.UseBookFoldPrintingSettings = true;
                options.ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto;
                options.ZoomBehavior = Aspose.Words.Saving.PdfZoomBehavior.FitPage;
                options.UseHighQualityRendering = true;
                options.OptimizeOutput = true;
                options.MemoryOptimization = true;
                //options.UpdateSdtContent = true;
                doc.AcceptAllRevisions();
                doc.Revisions.AcceptAll();
                RemoveComments(doc);
                doc.UpdateFields();
                doc.Save(outPdfPath, options);
                // doc.Save(outPdfPath + ".docx");
                res = true;
            }
            catch (Exception ex)
            {
                errorMessage = ex.Message;
                try
                {
                    Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
                    options.DmlRenderingMode = Aspose.Words.Saving.DmlRenderingMode.DrawingML;
                    options.ImageCompression = Aspose.Words.Saving.PdfImageCompression.Auto;
                    //options.MemoryOptimization = true;
                    options.TempFolder = Path.Combine(Path.GetTempPath(), "astmp");
                    try
                    {
                        Directory.CreateDirectory(options.TempFolder);
                    }
                    catch
                    {

                    }
                    
                    doc.AcceptAllRevisions();
                    doc.Revisions.AcceptAll();
                    RemoveComments(doc);
                    doc.Save(outPdfPath, options);
                    res = true;
                }
                catch (Exception e)
                {
                }
            }
            return res;
        }

@senthilspi

Please ZIP and attach your input Word document and problematic output PDF file for testing. We will investigate the issue and provide you more information on it.

I cannot upload the docs since those are clients data, but this issue is now occurring on more documents now. The same document layout is coming correct when I convert to PDF using word “save as” method. Whereas only using aspose some images are moving to next page while converting to pdf.

@senthilspi

Unfortunately, it is difficult to say what the problem is without documents. Please post your documents via private message . In order to send a private message with attachment, please click on my name and find “Message” button. Please check the attached image. send message.png (20.7 KB)

@senthilspi

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-21167 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

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

Hi Team,

Thanks for the update, Most the of issues have been resolved but still one more issue exist in the same doc i have attached. Even now there is one page count increased in the PDF file. It would be great if you have been able to address that as well.

Please see the page no (30 , 31and 32) file “Trithiocarbonate chapter 11e final.docx” i have sent earlier. Partial content of page 31 is moved to 30 and also some of the content is move to 32 as well.

Let me know for any further details

@senthilspi

We have tested the scenario using the latest version of Aspose.Words for .NET 20.11 and have not found the shared issue. Please check the attached output PDF. 20.11.pdf (2.5 MB)

The document name you shared with us is ‘testSpri.DOC’. If you are using different document, please ZIP and attach it here for testing. We will investigate the issue and provide you more information on it.

@senthilspi

Thanks for your query via private message. The issue ID related to other document is WORDSNET-21236. This issue has been resolved and its fix will be available in the next version of Aspose.Words i.e. 20.12. You will be notified via related forum once new release is available.