Word DOCX Document to PDF File Conversion using C# .NET | Prevent Overlapping in Table with three Columns and one Row

we are trying to convert a DOCX file to PDF using your software (Aspose.Words & Aspose.Pdf - version The document consist of a table with three columns and one row. The first and the last columns contain plain text and they behave correctly when being converted, but the middle one has another table inside which is about twice as width as its container size and has few rows with text inside - it’s a plain text as well but with few new lines to ensure nothing gets overlapped.
The problem is that after conversion content of the middle column is flowing out of its boundaries and is overlapping bottom margin of the page. It’s also being cut off and remaining text won’t jump to another page.

The code:

public class Program

    private static string Lic = ".\\Aspose.Total.lic";
    private static string InputDocPath = ".\\example.docx";
    private static string OutputPdfPath = ".\\example.pdf";
    private static volatile PdfLicense AsposePdfLicense;
    private static volatile WordsLicense AsposeWordsLicense;

    static void Main(string[] args)
        AsposePdfLicense = new PdfLicense();
        AsposePdfLicense.Embedded = true;

        AsposeWordsLicense = new WordsLicense();

        var bytes = File.ReadAllBytes(InputDocPath);
        using (var inputStream = new MemoryStream(bytes, 0, bytes.Length))
        using (var outputStream = new MemoryStream())
            var document = new Document(inputStream);
            document.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;
            document.Save(outputStream, SaveFormat.Pdf);
            File.WriteAllBytes(OutputPdfPath, outputStream.GetBuffer());

We look forward to you solving the issue.
Best regards,
WEBCON Sp. z o.o.
example.pdf (57.4 KB)
example.zip (61.5 KB)


After an initial test with the licensed latest (20.9) version of Aspose.Words for .NET, we were unable to reproduce this issue on our end. Please see the following output PDF document generated on our end:

Simple C# Code:

Document doc = new Document("C:\\example\\example.docx");

So, we suggest you to please upgrade to the latest version of Aspose.Words.

1 Like