ScroogeXHTML for the Java platform is a library which supports a subset of the Rich Text Format (RTF) standard and converts to HTML5 and XHTML, as a standalone document, or as a fragment which can be embedded in other documents, with little coding.
It supports RTF features such as hyperlinks, field results, simple tables, picture data extraction, and embeds PNG and JPG pictures as data URIs
It minimizes documents using CSS font definitions, and supports post processing of the intermediate DOM document for additional fine tuning
It is easy to use, and requires no external runtime libraries except the SLF4J logging facade
The online demo converts a RTF document and displays the result HTML5
Try the demoThe RTF for this example has been created from the original RTF specification version 1.9.1, a MS Word docx document, using the LibreOffice editor version 6.1.6.3.
td {
vertical-align: top;
border: 1px solid silver;
}
The RTF for this example has been created using LibreOffice 6.1.6.3, then opened in MS Wordpad.
Java code
package com.scroogexhtml.examples.helloworld;
import com.scroogexhtml.ScroogeXHTML;
public class Main {
public static void main(String ... args) {
ScroogeXHTML converter = new ScroogeXHTML();
String html = converter.convert("{\\rtf1 Hello world}");
System.out.println(html);
}
}
HTML output
<p>Hello world</p>
Java code
package com.scroogexhtml.examples.fontstyle;
import com.scroogexhtml.ScroogeXHTML;
public class Main {
public static void main(String ... args) {
ScroogeXHTML converter = new ScroogeXHTML();
String html = converter.convert("{\\rtf1 {\\b Bold \\i Bold Italic \\i0 Bold again} \\par}");
System.out.println(html);
}
}
HTML output
<p> <span style="font-weight:bold;">Bold </span><span style="font-weight:bold;font-style:italic;">Bold Italic </span><span style="font-weight:bold;">Bold again</span> </p>
Java code
public class Main {
public static void main(String... args) {
ScroogeXHTML scrooge = new ScroogeXHTML();
scrooge.setAddOuterHTML(true);
scrooge.addPostProcessListener(new PostProcessListener() {
@Override
public void postProcess(PostProcessEventObject e) {
Document doc = e.getDocument();
Element html = doc.getDocumentElement();
Node head = html.getFirstChild();
// add meta date
Element metaDate = doc.createElement("meta");
metaDate.setAttribute("name", "date");
metaDate.setAttribute("content", new Date().toString());
head.appendChild(metaDate);
}
});
String html = scrooge.convert("{\\rtf1 Hello world}");
System.out.println(html);
}
}
HTML output
<!DOCTYPE html> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Untitled document</title> <meta content="ScroogeXHTML for the Java(tm) platform 8.0" name="generator"> <meta content="Fri Jan 11 10:39:02 CET 2019" name="date"> </head> <body> <p>Hello world</p> </body> </html>
Text properties | |
Bold/italic/underlined | ✓/✓/✓ |
Foreground/background/highlight color | ✓/✓/✓ |
Subscript/superscript | ✓/✓ |
Strikethrough/hidden | ✓/✓ |
LTR/RTL text | ✓/✓ |
Unicode/DBCS text | ✓/✓ |
Language attribute | ✓ |
Paragraph properties | |
Left/right/centered/justified alignment | ✓/✓/✓/✓ |
Left/right/first line indent | ✓/✓/✓ |
Background color | ✓ |
Border box color/width | ✓/✓ |
Space before/after | ✓/✓ |
Numbered/unnumbered lists | ✓/✓ ① |
Tabulators | replaced by a sequence of non breaking spaces |
Tables | |
Simple tables | ✓ |
Total width | ✓ |
Left margin | ✓ |
Column width | ✓ |
Horizontal cell merging | ✓ |
Cell background color | ✓ |
Row height | ✓ |
Cell border color/width | ✓/✓ |
Other content | |
Hyperlink fields | ✓ |
Bookmark fields | ✓ |
Footnotes | ✓ |
Document types | |
HTML5 | ✓ |
XHTML 1.0 Transitional | ✓ |
Optimization | |
CSS based document minimizer | ✓ |
Font substitution | ✓ |
Logging framework | |
SLF4J support | ✓ |
Java platform | |
Minimum supported platform (Source edition) | Java SE 8 |
Tested with JDK 8 / JDK 11 / JDK 14 | ✓/✓/✓ |
Dependencies | |
SLF4J | ✓ |
Advanced features | |
Picture data extraction | ✓ ② |
Data URI image embedding | ✓ ③ |
Post processing (XPath based) | ✓ |
Android platform | ✓ see Base64Utils API docs |
Experimental | |
List templates (RTF listtable section) | ✓
generates <ol>/<ul>/<li> elements but result quality varies between RTF writer applications |
Tests | |
JUnit tests | ✓ (Source Edition) |
Other | |
Installer and uninstaller | ✓ |
① uses direct text formatting, does not generate <ol>/<ul>/<li> HTML elements ② conversion of image data to a web-safe format is not included ③ the included MemoryPictureAdapterBase64 supports embedding of PNG and JPG pictures |
Jar Edition | Source Edition | |
Lifetime license | ✓ | ✓ |
Free redistribution in single-user applications | ✓ | ✓ |
Basic support included | One year | One year |
Updates and upgrades included | One year | One year |
Server deployment license discount with Single Developer license purchase | ✓ | ✓ |
Instant electronic delivery | ✓ | ✓ |
Library source code included | - | ✓ |
Early access to development snapshots | - | ✓ |
Buy now |
Buy now |
|
Single Developer / Server Deployment License explained |
Released 26 June 2020
Read the "Getting Started" user guide
Browse the online API documentation
Browse release notes (new features, enhancements, and bug fixes)
Frequently asked questions: use cases, licensing, and technical
Contact Habarisoft for support and sales inqueries
Visit the blog for release announcements and useful news
Released 26 June 2020
get_app
On the library home page you will find a link to the download area for registered users. The credentials (user name and password) will be sent to you when a new release is available. New releases will also be announced on the blog at https://scroogexhtml.wordpress.com/
check
Yes, a free online demo version is available at https://www.scroogexhtml.com/sxd - To check if the library meets your requirements, you may also purchase a Single Developer license, which includes a 14 days full money back guarantee. This allows to test the full version of the library without any risk. The reseller (ShareIt) will give a full refund if you find that the library does not work as expected.
help_outline
The library does not convert embedded pictures. It extracts binary picture data from the RTF document. The picture data may be in WMF, JPEG, or other formats. For small images, embedding as Data URI is possible, and - depending on the image format - no additional data conversion is required .
check
Yes, each developer that uses our products must have their own license.
check
No, the licenses are perpetual. However, you will be using the last product version released before your free upgrade period expired.
check
Yes! If you are a registered user, please contact Habarisoft and ask for discount coupon code.
block
No, the source code is not redistributable, even if you change it. Under no circumstances is it acceptable to disclose the source to any third party.
help_outline
Server Deployment Licenses are required if ScroogeXHTML for the Java platform is used on the server side of a client/server application.
No. Server Deployment license are perpetual, except in the case of license violations.
No. The proof of purchase for Server Deployment licenses is your license document.
Actiance
Advocate Health Care
APT Business Solutions
Becton, Dickinson and Company
Canadian Natural Resources
Criterion Security Services
Datamine
Denim Group
e-vendo
Fatax
GE Medical Systems
Glencore International AG
Include Software
Iodine Software
洁茹 牛
Mayo Foundation
Manuh Solutions
Micrologos Software Developer
NVISIA
NxGen Software
PAGU.at
Philips Medical Systems
ProClarity Corporation
Promutuel Assurance
QuadraMed Corporation
Saxos Informatica
Scherer Software
Sigmalogic
TIP Technologies
YADA Systems
format_quote"This is an excellent unique product that has saved us many hours of work. It is simple to use with lots of documentation."
format_quote"Scrooge has really helped me out! I'm converting a database of 10,000 questions in RTF into HTML, Scrooge has been invaluable!"
format_quote"It works great and it is stunningly fast - on production, converting 115.000 documents takes 25 seconds instead of 9 hours."
format_quote"We are very, very glad with this Component"