Using this coding html only will be extracted. but i need to extract the image from rtf. i think the problem is in RTFEditorKit. please suggest your ideas to solve this.
private static String rtfToHtml(Reader rtf) throws IOException {
JEditorPane p = new JEditorPane();
p.setContentType("text/rtf");
RTFEditorKit kitRtf = (RTFEditorKit) p.getEditorKitForContentType("text/rtf");
try {
kitRtf.read(rtf, p.getDocument(), 0);
kitRtf = null;
EditorKit kitHtml = p.getEditorKitForContentType("text/html");
Writer writer = new StringWriter();
kitHtml.write(writer, p.getDocument(), 0, p.getDocument().getLength());
return writer.toString();
} catch (BadLocationException e) {
e.printStackTrace();
}
return null;
}