Problems with title and legend when saving as PDF using Aspose.Words

I am encountering issues while using Aspose.Words to convert a word document into a PDF.
Aspose.Words Version : 25.6.0
When i use the code to convert “test.docx” to “test.pdf”:

var testDoc = new Document("D:\\test.docx");
testDoc.Save("D:\\test.pdf", SaveFormat.Pdf);

The ValueAxis title and legend were overlap with Tick Lable. It doesn’t match the appearance when they are opened with Word.

test.docx (35.4 KB)

test.pdf (40.7 KB)

@huanguwjie1

Thank you for your request and for providing the details. I understand that you are encountering an issue with overlapping titles, legends, and tick labels when converting a Word document to a PDF using Aspose.Words.

Here are some steps to help you diagnose and potentially resolve the issue:

Steps to Diagnose and Resolve the Issue

1. Check Chart Rendering Options

Ensure that you are using the latest version of Aspose.Words. Sometimes, specific chart rendering issues are fixed in newer releases.

2. Use High-Res Image Conversion

If you are still encountering issues with chart rendering, you can try converting charts in your document to images. This approach can sometimes resolve rendering discrepancies.

Here is a sample code snippet for converting charts to images:

// Load the document
var testDoc = new Document("D:\\test.docx");

// Iterate through each chart in the document
foreach (Shape shape in testDoc.GetChildNodes(NodeType.Shape, true))
{
    if (shape.HasChart)
    {
        // Render the chart to an image
        var stream = new MemoryStream();
        shape.Chart.ToImage(stream, new ImageSaveOptions(ImageFormat.Png));
        stream.Position = 0;

        // Replace the chart with the image
        shape.ImageByteArray = stream.ToArray();
    }
}

// Save the document
testDoc.Save("D:\\test.pdf", SaveFormat.Pdf);

3. Adjust Chart Layout in Word

Sometimes, adjusting chart properties directly in Word (like increasing the spacing between elements) before conversion can help. Here’s how you can do that:

  1. Open the Word document in Microsoft Word.
  2. Select the chart and click on the “Chart Tools” tab.
  3. Adjust the chart axes, gridlines, and other elements to ensure there is enough spacing.

4. Use Custom PDF Save Options

You can configure the PdfSaveOptions class to improve the quality of the PDF output.

var options = new PdfSaveOptions();
options.JpegQuality = 100; // Highest quality

var testDoc = new Document("D:\\test.docx");
testDoc.Save("D:\\test.pdf", options);

5. Check Word Document Content

Ensure that the Word document itself is well-structured and formatted properly. Sometimes poorly formatted content can lead to rendering issues.

Additional Resources

If after trying these steps you still encounter issues, please provide more details or any error messages that appear. This information will help in understanding the problem further and providing a more precise solution.

I tried the above methods, but the problem still persisted. Could you please check the reasons by referring to the examples I have provided.

@huanguwjie1
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28432

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Could you please tell me if there has been any progress?

@huanguwjie1 That issue is now in the queue to be analyzed.

If there has been any progress?

@huanguwjie1 Unfortunately, there are no updates regarding this issue yet. Please accept our apologies for your inconvenience.