StringIndexOutOfBoundException in java-examples

Hi folks,
I was wondering if something went wrong when downloading your provided examples for Java from GitHub

I already tried the word examples and they worked perfectly fine.
Now when I’m trying to convert any pdf-file, I get a StringIndexOutOfBoundsException on save action.
See stacktrace:
Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at com.aspose.pdf.internal.ms.System.l4u.l0j(Unknown Source)
at com.aspose.pdf.internal.ms.System.l4u.lj(Unknown Source)
at com.aspose.pdf.FontRepository.lj(Unknown Source)
at com.aspose.pdf.FontRepository.lI(Unknown Source)
at com.aspose.pdf.FontRepository.getLocalFontPaths(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v.l0l(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v.lc(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v.lv(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v.lI(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v$2.lI(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v$2.lf(Unknown Source)
at com.aspose.pdf.internal.l13p.lI$1.lI(Unknown Source)
at com.aspose.pdf.internal.l13p.lt.lj(Unknown Source)
at com.aspose.pdf.internal.l13p.lI.lb(Unknown Source)
at com.aspose.pdf.internal.l4k.l0v.lj(Unknown Source)
at com.aspose.pdf.l6y.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.save(Unknown Source)
at com.aspose.pdf.Document.save(Unknown Source)
at com.aspose.pdf.examples.AsposePdfExamples.DocumentConversion.PDFToHTMLSingleHTMLWithAllResourcesEmbedded.main(PDFToHTMLSingleHTMLWithAllResourcesEmbedded.java:23)
This has happened for any Pdf to HTML conversion and I also tried Pdf to Doc conversion.
Am I missing something here?
Best regards,
Nicole

@nseidel

Thanks for contacting support.

We have tested the scenario in our environment and were unable to notice any issue in GitHub project. Would you please share the environment details with us in which you are trying to run it e.g. OS Name and Version, JDK Version, etc. Also, it would be helpful if you can provide some sample files as well. We will test the scenario with your files in particular environment and share our feedback accordingly.

Hi @asad.ali,

Thank you for your reply.
I’m running eclipse Mars v4.5.2 on Windows 10 using jdk 1.8. In the beginning, I downloaded your word-samples (for you word package) which worked perfectly; I could successfully convert doc-files to HTML. When I downloaded the pdf-sample package and adjusted the file paths to the provided test pdf files, I got this Exception. So sample files can be found on GitHub as well. I’ve tried the “input.pdf”, the “source.pdf” and the “PathToDirDetermineLineBreak_out.pdf”.
Cheers,
Nicole

@nseidel

Thanks for your feedback.

We have again tested the project at our end and were unable to find any issue. However, could you please share which particular example you have tried at your side and faced the issue. We will further proceed to help you accordingly.

@nseidel

Adding more to our previous comments, we have tested PDFToHTMLSingleHTMLWithAllResourcesEmbedded as well in our environment but still were unable to notice any issue. NoException.png (24.4 KB)

Could you please try to re-download the project and test it again in your environment. In case issue still persists, please share screenshot of code snippet and exception with us. We will further proceed accordingly.

Hi @asad.ali,

thanks for trying to help me figure this out, but I’ve still got the same issue.
I tried the PDFToHTMLSingleHTMLWithAllResourcesEmbedded just like before, with a freshly downloaded project, result see attached. StringException.png (55.9 KB)

But nevermind, I think it has to be something particularly odd at my site and I’ll just leave that for the moment. Thank you for investigating at your site!
Cheers,
Nicole

@nseidel

Thanks for your feedback.

Yes, this seems your environment related issue. You may also try testing the scenario in different environment. In case you need further assistance, please feel free to contact us.