Overlapping tables- images

Good Morning

I am using Aspose.Pdf version 9.5. Currently, I am experiencing a rendering error. My project calls for displaying a an image object and a grey box with text both formatted with tables in a word file, then converting that page to pdf. The page displays properly as a word document. When using Microsoft Word, converting the same file to pdf that is used in the application, the word file coverts properly. In the application, the table containing the gray box and text overlaps the image. How can I fix this issue?

Hi there,

Thanks for your inquiry. We will appreciate it if you please share your sample code and document here. We will look into it and will guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,

This sample file has all the same mark up as the actual file, tables, bookmark locations, etc. Really all that is happening is there is a call to covert the file to pdf, the resulting file doesn’t match the file prior to the conversion.

public static FileInfo SaveAsOutputType(string fileToConvert,
    string desiredFinalName, string documentOutputType, int waterMarkId,
    IExecutePackage db, IDocumentSaver fileSystem)
{

    using (new PerformanceTracer("ExhibitRenderer", "SaveAsOutputType"))
    {

        // Save as PDF if PDF output requested
        // So… aspose will convert to pdf if you provide a .pdf extension?
        // outputTypeFilename = bun.GetRenderedExhibitOutputTypeFullName();
        FileInfo fileToConvertInfo = new FileInfo(fileToConvert);
        FileInfo desiredFinalNameInfo = new FileInfo(desiredFinalName);

        string useDocx = ConfigurationManager.AppSettings["UseDocx"];
        if (useDocx != null)
        {
            if (useDocx == "DOCX" || useDocx.ToUpper() == "YES")
            {
                if (desiredFinalName.EndsWith("DOC"))
                {
                    desiredFinalName = desiredFinalName.Replace(".DOC", ".DOCX");
                }
            }
        }

        // TODO: Should check extension, not full file name. this is brittle.
        if (fileToConvertInfo.Extension != desiredFinalNameInfo.Extension)
        {

            Document _document = fileSystem.TryToOpen(fileToConvert);

            // First, strip the existing watermark if converting from .doc to .pdf
            if (documentOutputType == "PDF")
            {
                // It seems we have to save for real to covert to pdf? Indeed. Don’t forget to remove 
                fileSystem.SaveForReal(fileToConvert);
                _document = fileSystem.TryToOpen(fileToConvert);

                // This remove is buggy. Addressed by not adding watermark in 1st place.
                // RemoveWaterMarks(*document);

                // Now try to re-add the watermark in PDF terms
                // Save it as PDF without a watermark
                Aspose.Words.Saving.PdfSaveOptions pso = new Aspose.Words.Saving.PdfSaveOptions();
                pso.BookmarksOutlineLevel = 1;
                pso.PreserveFormFields = true;
                pso.ExportDocumentStructure = true;
                pso.SaveFormat = SaveFormat.Pdf;
                FileInfo desiredFile = new FileInfo(desiredFinalName);
                if (desiredFile.Exists)
                {
                    // This happens on re-run of a guid.
                    desiredFile = new FileInfo(desiredFinalName.Replace(".", "*" + DateTime.Now.Ticks + "."));
                    // throw new InvalidOperationException("That File already exists: " + desiredFinalName);
                }
                SaveOutputParameters sop = _document.Save(desiredFinalName, pso);

                // Open it back up for editing
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(desiredFinalName);

                ApplyWatermarkToPdf(pdfDocument, WaterMarkText(waterMarkId, db));

                pdfDocument.Save(desiredFinalName);
                // Okay if we got this far, we don’t need that .DOC anymore.
                File.Delete(fileToConvert);

                // Saves watermark nicely, but not bookmarks
                return desiredFile;
            }

            fileSystem.TryToSave(_document, desiredFinalName); //So that in memory matches disk. Not necessary? Not sure.
            fileSystem.SaveForReal(desiredFinalName);

            if (!desiredFinalNameInfo.Exists)
            {

                throw new InvalidOperationException("Expected file to exist but it
                doesn’t: " + desiredFinalNameInfo.FullName);
            }
        }

        Document documentToJustSave = fileSystem.TryToOpen(fileToConvert);
        fileSystem.TryToSave(documentToJustSave, desiredFinalName);

        fileSystem.SaveForReal(desiredFinalName);

        // FileInfo expectedFile = (new FileInfo(desiredFinalName));
        if (!desiredFinalNameInfo.Exists)
        {

            throw new InvalidOperationException("Expected file to exist but it
            doesn’t: " + desiredFinalNameInfo.FullName);
        }
    }
    return new FileInfo(desiredFinalName);
}

Hi,

Thanks for your inquiry. After an initial test with Aspose.Words for .NET 15.1.0, I was unable to reproduce this issue on my side (please see attached out.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.
https://releases.aspose.com/words/net

Best regards,

We have updated to the latest version of Aspose word, and we still have the issue. Please advise. Thank you!

Hi,
Did you check the output attached to this post https://forum.aspose.com/t/47216 and is it fine? Please also share if you are using latest version in evaluation mode or the output PDF if you get a different output using Aspose.Words for .NET 15.1.0.
Best Regards,

What settings were used to produce your output? On our side, just using aspose.words.save(“blahblah.pdf”) produces incorrect output and Aspose.words.save(“blah\blah\blah”, pdfoptions) produces incorrect output, the input file a word document saves fine. Is it an issue of margins?

Hi,

Thanks for your inquiry. Can you please attach your output PDF file showing the undesired behavior here for our reference. I used the code from here to generate output PDF file on my side. Can you provide simplified piece of code to be able to reproduce the problems on our end? Thanks for your cooperation.

Best regards,