ArgumentOutOfRangeException in ViewerHtmlHandler.GetPages method

Hello,

We trying to use GroupDocs Viewer for .NET v17.6.0 for getting html representation of some PDF files. But ViewerHtmlHandler.GetPages(Stream fileStream) method causes the ArgumentOutOfRangeException trying handle file.

Here is the sample PDF file in attachments.

And the stack trace is

Exception thrown: ‘System.ArgumentOutOfRangeException’ in mscorlib.dll
Exception thrown: ‘GroupDocs.Viewer.Exception.GroupDocsViewerException’ in GroupDocs.Viewer.dll
Exception thrown: ‘GroupDocs.Viewer.Exception.GroupDocsViewerException’ in mscorlib.dll

@GrigoryDivotchenko


Thanks for taking interest in GroupDocs.Viewer for .NET.

We have successfully reproduced your reported issue at our end and logged it in our Issue Tracking System with ID: VIEWERNET-1241. We shall further investigate this issue and in case of any updates, we’ll keep you informed. Please stay tuned with us.

Warm Regards

@GrigoryDivotchenko,

We are delighted to inform you that the issue mentioned in this topic has been resolved. The fix of the issue is available in GroupDocs.Viewer for .NET 17.8.0.

The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method. Indexing an empty list will always throw an exception. Use a method like Add to append the item to the end of the list, or Insert to place the item in the middle of the list somewhere, etc. You cannot index into a list if that offset doesn’t exist.

Typically, an ArgumentOutOfRangeException results from developer error. Instead of handling the exception in a try/catch block, you should eliminate the cause of the exception or, if the argument is returned by a method call or input by the user before being passed to the method that throws the exception, you should validate arguments before passing them to the method.

1 Like

@lingmaaki

That’s right.