Here you can find the source of rtfToPlain(String rtf)
public static String rtfToPlain(String rtf)
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import javax.swing.text.Document; import javax.swing.text.rtf.RTFEditorKit; public class Main { public static String rtfToPlain(String rtf) { RTFEditorKit rtfParser = new RTFEditorKit(); Document document = rtfParser.createDefaultDocument(); try {//from ww w. j a va2 s.c om rtfParser.read(new ByteArrayInputStream(rtf.getBytes()), document, 0); return document.getText(0, document.getLength()); } catch (Exception e) { throw new RuntimeException("Error converting RTF to plain text", e); } } }