Aspose.NET C# Word To PDF

IssueWithWordConversion.pdf (12.4 KB)

IssueWithWordConversion.docx (33.2 KB)

We are having issues converting Word to PDF. You can see in the PDF generated its missing a lot of content from the table at the bottom of the page.

Here is the code I am using to convert the file.

public static string ConvertWordToPdf(string inputFilePath, string outputFilePath)
{
    try
    {
        // Load the Word document
        Document doc = new Document(inputFilePath);

        // Create PDF save options
        PdfSaveOptions saveOptions = new PdfSaveOptions
        {
            FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
            ExportDocumentStructure = true,
            JpegQuality = 100, // Set JPEG quality
            UseHighQualityRendering = true // Use high-quality rendering
        };

        saveOptions.ImageColorSpaceExportMode = PdfImageColorSpaceExportMode.Auto;

        // Save the document as PDF
        doc.Save(outputFilePath, saveOptions);
        Console.WriteLine("SUCCESS" + outputFilePath);
        return "Success";
    }
    catch (Exception ex)
    {
        return $"Failure|{ex.Message}";
    }
}

Any idea what the issue is?

thanks, Dave

@david_j_meyer2_boeing_com

It looks like the conversion itself is working – the problem is that the layout of the table is not being fully calculated before the PDF is rendered.
Below are the usual checks that resolve the “missing rows / cells at the bottom of a table” symptom:

  1. Confirm the Aspose.Words version – the issue was fixed in the 22.x releases. If you are on an older build (e.g., 21.10 or earlier), upgrade to the latest .NET version.

  2. Force a layout update before saving

public static string ConvertWordToPdf(string inputFilePath, string outputFilePath)
{
    try
    {
        // Load the document
        var doc = new Document(inputFilePath);

        // Ensure the layout is up‑to‑date (important for large tables)
        doc.UpdatePageLayout();

        // Optional – use default PDF options first to see if the problem persists
        var saveOptions = new PdfSaveOptions
        {
            FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
            ExportDocumentStructure = true,
            JpegQuality = 100,
            UseHighQualityRendering = true,
            ImageColorSpaceExportMode = PdfImageColorSpaceExportMode.Auto
        };

        doc.Save(outputFilePath, saveOptions);
        return "Success";
    }
    catch (Exception ex)
    {
        return $"Failure|{ex.Message}";
    }
}
  1. Test without any custom PdfSaveOptions – call doc.Save(outputFilePath, SaveFormat.Pdf); to verify that the options themselves are not interfering.

  2. Check the source document – if the table contains floating objects, text boxes, or very large rows, try simplifying the table (e.g., remove complex cell margins or split the table into two) and see whether the PDF renders correctly.

  3. Capture a minimal reproducible file – if the issue remains after the steps above, create a small Word file that contains the same table layout and attach it when you open a support ticket. Include the exact Aspose.Words version you are using and the code snippet above.

If after upgrading and calling UpdatePageLayout() the missing content is still present, please provide the minimal test file and version number so we can investigate further.

I’m using the latest stable versions available. I just updated to ensure that was not the problem. The version is 25.12.0 for Words and 25.11.0 for PDF.

@david_j_meyer2_boeing_com

How to convert a Word document to PDF with Aspose.Words for .NET

  1. Add the NuGet package

    Install-Package Aspose.Words
    
  2. Load the Word file and save it as PDF

    using Aspose.Words;
    using Aspose.Words.Saving;   // only needed if you want custom PDF options
    
    public static void ConvertWordToPdf(string wordPath, string pdfPath)
    {
        // Load the source document
        Document doc = new Document(wordPath);
    
        // (Optional) fine‑tune PDF output
        PdfSaveOptions options = new PdfSaveOptions
        {
            FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
            ExportDocumentStructure = true,
            JpegQuality = 100,
            UseHighQualityRendering = true,
            ImageColorSpaceExportMode = PdfImageColorSpaceExportMode.Auto
        };
    
        // Save as PDF – the format is inferred from the .pdf extension
        doc.Save(pdfPath, options);   // or simply doc.Save(pdfPath);
    }
    

Key points

  • Document.Save(string fileName) automatically picks the format from the file extension, so doc.Save("out.pdf") is enough for a basic conversion.
  • Use PdfSaveOptions (as shown) when you need higher‑quality rendering, font embedding, or other PDF‑specific settings.

That’s all you need to convert Word → PDF with the latest Aspose.Words for .NET.

My code is the same as yours and it is not converting the document correctly. I have simplified the table and it only has 1 box with text “dave” in it. The rest of the columns are empty. Now the table is not visible at all.

    public static string ConvertWordToPdf(string inputFilePath, string outputFilePath)
    {
        try
        {
            // Load the Word document
            Document doc = new Document(inputFilePath);

            // Ensure the layout is up‑to‑date (important for large tables)
            doc.UpdatePageLayout();

            // Create PDF save options
            PdfSaveOptions saveOptions = new PdfSaveOptions
            {
                FontEmbeddingMode = PdfFontEmbeddingMode.EmbedAll,
                ExportDocumentStructure = true,
                JpegQuality = 100, // Set JPEG quality
                UseHighQualityRendering = true, // Use high-quality rendering
                ImageColorSpaceExportMode = PdfImageColorSpaceExportMode.Auto
            };

            // Save the document as PDF
            doc.Save(outputFilePath, saveOptions);
            Console.WriteLine("SUCCESS" + outputFilePath);
            return "Success";
        }
        catch (Exception ex)
        {
            return $"Failure|{ex.Message}";
        }
    }

Aspose.PDF version 25.11.0
Aspose.Words version 25.12.0

Any help you can provide is appreciated.

Thanks, Dave
IssueWithWordConversion3.pdf (10.9 KB)

IssueWithWordConversion3.docx (32.9 KB)