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

Free Support Forum - aspose.com

RtfStringToDocument for Java

This sample appears to be out of date. Can you provide a new version of just the RtfStringToDocument(string rtf) method for Java?


Thanks for your inquiry. Please check the following RtfStringToDocument method. Hope this helps you.

private static Document RtfStringToDocument(String rtf) throws Exception
    Document doc = null;

    InputStream rtfStream = new ByteArrayInputStream(rtf.getBytes(StandardCharsets.UTF_8));
    LoadOptions loadoptions = new LoadOptions();

    doc = new Document(rtfStream, loadoptions);
    return doc;