Free Support Forum - groupdocs.com

NullPointerException for PDF

Hi Team,

I’m reviewing GroupDocs.Viewer for one of our customers applications.
I am downloaded and using ‘com.groupdocs:viewer’ 2.9.1 jar’ viewer is working fine for .doc and .docx files, without any issues, But for PDF I am getting error please find screenshot in attachment.

Error is being thrown from 'ViewDocumentHandlerServlet.java’
writeOutput(MediaType.APPLICATION_JSON, response,
viewerHandler.viewDocumentHandler(request, response));

Please let is know how to resolve this issue.

Regards,
Shiva

Hello ,

Sorry to see that you have such issue. We tried to reproduce the issue on our side, but your file is rendering well for us and we haven't such issue.
Since that to be able to reproduce the issue we will need additional information. Please share with us next: Apache version , Java version and OS version.

If you use for testing the Linux or Mac OS , you should try to add Windows fonts, because the issue can arises if on your OS doesn't Windows fonts.

Please check the documentation for how to add Windows fonts to Linux OS here .

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+

Hi

I am working on Linux OS.
As you told we need to install windows fonts here I have installed to my Linux machine.
As this error is from “aspose” they have option to set font location as here.
How can I specify font location.

Regards,
Shiva

Hello Shiva,

Thanks for your posting and using GroupDocs.Viewer. This parameter will be available in next release the GroupDocs.Viewer for Java 2.10.0 , which will be released this week. But as workaround you can use the code "sudo apt-get install msttcorefonts" or add the fonts to Linux folders (/usr/share/fonts or /usr/local/share/fonts) and after this, your file should be rendered well.

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+

Hi,

I have done this tow steps
1) Installed true test fonts using "sudo apt-get install msttcorefonts"
2) add the fonts to Linux folders (/usr/share/fonts or /usr/local/share/fonts)

Even after doing this still we are getting same issue.

Are you sure this ‘NullPointerException’ is related to true text font?

Regards,
Shiva

Hello Shiva,

Thank you for using GroupDocs.Viewer

We just tried to ask you, that you try to add the fonts to your OS, this scenario helped for a lot of users. At this moment we can't reproduce your issue. Could you please share with us next: Apache version , Java version and a type of project that you use (Spring, Dropwizard or Web) .

Also you can download our new version the GroupDocs.ViewerJava here. It include the new setting - fontsPath.

Please come back with your details and we will glad to help you .

Best regards
Evgen Efimov

http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+