Invoking getViewInfo method generates exception in Java

Hi,

I need to get the page count of a xls file through the ViewInfo class but whenever I try to get an instance of it the following exception is thrown:

java.lang.IndexOutOfBoundsException: Index: 3, Size: 3.

Below you can see the code snippet:

Viewer viewer = new Viewer(file.getPath().toString());
ViewInfo viewInfo = viewer.getViewInfo(ViewInfoOptions.forJpgView(false));
1 Like

@victortjk,

Can you please specify the API version that you integrated in the project (e.g. 19.10, 20.1). Also share the sample/problematic XLS file. Do you face this issue only in the case of XLS? We’ll appreciate your cooperation in this regard.

1 Like

I am using version 20.1 and as an example I have used the sample.xlsx from the Viewer Examples project. As a matter of fact I have tried from the project too and got the same exception.

I ran the HelloWorld and tried to get the ViewInfo by passing in ViewInfoOptions.forJpgView(false).

1 Like

@victortjk,

Thank you for the details. We are investigating this scenario. As there’s any update, you’ll be notified.

1 Like

@victortjk,

We cannot reproduce this issue at our end. Please have a look at this screenshot.JPG (57.1 KB). Can you please share a simple/console application using that issue could be reproduced.

@atirtahir3, here is the screenshot of the console and the code executed.:
image.png (34.5 KB)

I have only modified the file to be rendered in the following class:

1 Like

@victortjk,

Please share the modified file with us. Because using sample.xlsx that is already available in the example project, we cannot reproduce this issue.

@atirtahir3 I meant that I modified the class by selecting the xlsx file instead of docx file and I didn’t modify the xlsx content.

I will test it in another environment and check if this issue occurs too.

Thanks for your promp reply!

1 Like

@victortjk,

Yes, because we are getting right output. Have a look at this screenshot.JPG (167.5 KB).

@atirtahir3 I was able to run this in another environment and it works fine. I will investigate why it occurs here but you can close this issue.

Thanks a lot!!

1 Like

@victortjk,

You are welcome.

@atirtahir3, in which OS did you run the code? I successfully ran the code on macOS but the output is not correct… it should render 24 jpg files, 8 jpg for each sheet in the ‘sample.xlsx’ and it just rendered 2 jpg files only…
On the other hand when I don’t try to invoke ‘getViewInfo’(which throws the exception on Windows and on my Ubuntu machine) it renders as expected the 24 jpg files…

1 Like

@victortjk,

We processed/ran the code on Windows 10 OS.

We are investigating this scenario. Your investigation ticket ID is VIEWERJAVA-2186. As there’s any update, you’ll be notified.

1 Like

Hi @atirtahir3 !

Any news regarding this issue?

Thanks for your attention!

1 Like

@victortjk,

This issue is still under investigation. We’ll update you as there’s any progress.

@victortjk

Your reported issue VIEWERJAVA-2186 is now fixed in API version 20.7.

Thanks for the info @atirtahir3! I will check again this issue soon :slight_smile:

@victortjk

You are welcome.

hi @atirtahir3 can I get my license key renewed so I can resume my POC?

@victortjk

This query will be assisted here.