We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Manage System.IndexOutOfRangeException when Converting DOCX Document to PDF using .NET C# API

Hi Team,

When I convert docx file to PDF through Aspose.Words.dll (19.10) then it throws the error related to “IndexOutOfRangeException”. Please see the error message and the file attached (zip file) with this post.

Please see below code for the reference:

    var filePath = @"C:\Temp\ReportFileWhichShowsErrorOnAspose.docx";
    var pdfOutputFilePath = @"C:\Temp\docxfile.pdf";

    new Document(filePath).Save(pdfOutputFilePath);

Please let me know how can I fix this issue.


ErrorInConvertingDocxFiletoPDF.zip (329.4 KB)


We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-19744. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.


We have good news for you i.e. WORDSNET-19744 has now been resolved. The fix of this issue will be included in the 20.2 (next version) of Aspose.Words. We will inform you via this thread as soon as the next version containing the fix of your issue will be released at the start of next month.

During investigation, following two additional issues have also been identified:

  1. Rendering of the trend-line equation if “Display Equation on chart” is set which is a new feature. The ID of this issue is WORDSNET-19864.
  2. Rendering of the R-squared value if “Display R-squared value on chart” is set which is also a new feature. The ID of this issue is WORDSNET-19865.

Your thread has been linked to these two issues and you will be notified as soon as they are resolved.

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

A post was split to a new topic: Word to PDF | Rendering of Trendline Equation or Chart Trend Lines C# .NET