Facing NullPointerException with Groupdocs.Editor API

I am using below code :slight_smile:

InputStream inputStream = new FileInputStream(“D:/SarasKumar/saras1.html”);
InputHtmlDocument htmldoc = EditorHandler.toHtml(inputStream);
String embeddedContent = htmldoc.getEmbeddedHtml();

the below exception occured when calling —> EditorHandler.toHtml(inputStream);

java.lang.NullPointerException
at com.groupdocs.editor.words.wordstohtml.a.e.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.e.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.b.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.l.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.l.b(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.l.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.b.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.r.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.b.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.b(Unknown Source)
at com.groupdocs.editor.EditorHandler.a(Unknown Source)
at com.groupdocs.editor.EditorHandler.a(Unknown Source)
at com.groupdocs.editor.EditorHandler.toHtml(Unknown Source)

@saras1234,

In order to investigate this issue at our end, we need following details form you:

  • API version that you integrated in the API
  • Problematic/source file

Hello team i am using classic-editor-with-track-changes.js API
and getting this error into .java File

Hi Team , for the below code i am also facing another type of exception

Code snippet:
InputStream inputStream = new FileInputStream(“D:/SarasKumar/groupdoc/P0004-assword-Protection-Policy.docx”);
InputHtmlDocument htmldoc = EditorHandler.toHtml(inputStream);
String embeddedContent = htmldoc.getEmbeddedHtml();

Related exception :

com.groupdocs.editor.internal.c.a.ms.System.NotSupportedException: Node type ‘{0}’ (’{1}’) and corresponding instance of ‘{2}’ currently are not supported
at com.groupdocs.editor.words.wordstohtml.b.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.a(Unknown Source)
at com.groupdocs.editor.words.wordstohtml.a.b(Unknown Source)
at com.groupdocs.editor.EditorHandler.a(Unknown Source)
at com.groupdocs.editor.EditorHandler.a(Unknown Source)
at com.groupdocs.editor.EditorHandler.toHtml(Unknown Source)
at com.java.ckeditor.controller.MyController.getUploadHtmlFile(MyController.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
a

@saras1234,

Please mention the API version (JAR file) that you integrated in the project (e.g. 19.6.1, 19.6.2, 19.6).

Hi Team,

I am using these two dependency mentioned below:
groupdocs-conversion version —> 19.6.2
groupdocs-editor version ----> 19.4

com.groupdocs groupdocs-conversion 19.6.2 com.groupdocs groupdocs-editor 19.4
1 Like

@saras1234,

Thanks for sharing the details. We are not able to reproduce this issue at our end. Please have a look at this output.JPG (242.2 KB)
In order to further investigate the issue, we need saras1.html file.

Hi Team,

Can you please send me the setup steps or demo code for converting any type of file to html and also after the html conversion i want to send this html as a string in response body from the spring controller.

Please help asap i am totally stuck.

@saras1234,

We’d recommend you to download and explore this example project. You can convert DOCX to HTML and then get embedded html using below code.

InputStream inputStream = new FileInputStream("D:/Data/Storage/source.docx");
InputHtmlDocument htmlDoc = EditorHandler.toHtml(inputStream);
// Obtain HTML document content
String cssContent = htmlDoc.getEmbeddedHtml();
System.out.println(cssContent);

Please see this output.png (172.6 KB).

For now, API only supports these file formats.