We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

RTF to HTML conversion issue with image rendering using Java

Issue) RTF text with single image only is not converted properly to HTML. So, HTML file comes as blank.
But if we authore some text and then image, in that case it is working fine.
Also, With single image only as RTF text, PDF is generated properly but HTML is somehow not working.

Sample java code used for reference:
Added following dependency and repository in pom.xml

com.aspose aspose-words 20.3 jdk17

Aspose Java API

============= Java code with input and output option ============

// from rtf stored in database get bytes convert to Input stream
InputStream rtfStream = new ByteArrayInputStream(bytes);

RtfLoadOptions rtfOptions = new RtfLoadOptions();
Document document = new Document(rtfStream, rtfOptions);

HtmlSaveOptions htmlOptions = new HtmlSaveOptions(SaveFormat.HTML);
document.save(“C:\Users\pprajapati\Desktop\9122\output.html”, htmlOptions);
document.save(“C:\Users\pprajapati\Desktop\9122\output.pdf”, pdfOptions);

System.out.println(“Document loaded and saved successfully.”);


Please ZIP and attach your input RTF here for testing. We will investigate the issue and provide you more information on it.