Wingdings bullets workaround (XPath based post-processing)

Some RTF writers (such as WPTools) use the Wingdings font for bullet signs in unnumbered lists. Wingdings is not a web-safe font, so additional tweaking is required to transform a document generated by ScroogeXHTML to web-safe HTML5.

The library already includes post-processing classes, so we can build a workaround based on existing code and clean up the intermediate DOM.

A basic implementation is shown below. It iterates all nodes which carry a font-family:Wingdings style and does two things:

  • replace the ‘l’ character with a Unicode bullet sign
  • replace the ‘Wingdings’ font name with ‘serif’

Note: older versions of WPTools 7 emitted the font name as “WingDings” (with capital D) and used a “Ÿ” character instead of “l” for the bullet. The code example below has been simplified for newer WPTools versions for better readability.

public void postProcess(PostProcessEventObject e) {
  try {
    XPathFactory xpathFactory = XPathFactory.newInstance();
    // XPath to find Wingdings text nodes.
    XPathExpression xpathExp = xpathFactory.newXPath().compile(
       "//span[contains(@style, 'font-family:Wingdings')]");
    NodeList nodes = (NodeList) xpathExp
      .evaluate(e.getDocument(), XPathConstants.NODESET);

    for (int i = 0; i < nodes.getLength(); i++) {
      Element node = (Element) nodes.item(i);

      // replace the bullet
      String textContent = node.getTextContent();
      if ("l".equals(textContent)) {
        node.setTextContent("\u25CF");
      }

      // replace the font name
      String style = node.getAttribute("style");
      style = style.replace("Wingdings", "serif");
      node.setAttribute("style", style);
    }
  } catch (XPathExpressionException ex) {
      LOGGER.error(ex.getMessage(), ex);
  }
}

Tiny RTF Viewer 2.7 using ScroogeXHTML RTF to HTML5 converter

Habarisoft released Tiny RTF Viewer 2.7 for Android™. This small viewer app converts RTF documents (which can be stored locally or accessed by choosing a hyperlink in a web browser) to HTML5, and displays them in the internal web browser.

Google play

For the internal conversion from Rich Text Format to HTML5, it uses ScroogeXHTML for the Java™ platform version 6.3. More information and an on-line demo of the converter library are available at https://www.scroogexhtml.com/

scrooge_portrait_logo_2016

Android is a trademark of Google Inc. ♦ Google Play is a trademark of Google Inc.

 

ScroogeXHTML for the Java™ platform 6.3.0 – fast RTF to HTML5 and XHTML conversion

Habarisoft released version 6.3.0 of its RTF to HTML5 and XHTML converter library, ScroogeXHTML for the Java™ platform. The new version introduces 2 enhancements.

You can evaluate the new release with the online converter demo, which displays the configuration property values of the converter, and allows to modify many of them.

scrooge_portrait_logo_2016

 

ScroogeXHTML for the Java™ platform 6.2.0 – fast RTF to HTML5 and XHTML conversion

Habarisoft released version 6.2.0 of its RTF to HTML5 and XHTML converter library, ScroogeXHTML for the Java™ platform. The new version resolves 3 bugs and introduces 3 enhancements and new features, including support for table row height and text format changes within hyperlinks.

You can evaluate the new release with the online converter demo, which displays the configuration property values of the converter, and allows to modify many of them.

scrooge_portrait_logo_2016

 

“Tiny RTF Viewer” 2.5 using ScroogeXHTML RTF to HTML5 converter

Habarisoft released Tiny RTF Viewer 2.5 for Android. This small viewer app converts RTF documents (which can be stored locally or accessed by choosing a hyperlink in a web browser) to HTML5, and displays them in the internal web browser.
Google play

For the internal conversion from Rich Text Format (RTF) to HTML5, the app uses the ScroogeXHTML library from Habarisoft. More information and an on-line demo of the converter library are available at https://www.scroogexhtml.com/

scrooge_portrait_logo_2016

Android is a trademark of Google Inc. ♦ Google Play is a trademark of Google Inc.

 

ScroogeXHTML for the Java™ platform 6.1.0 – fast RTF to HTML5 and XHTML conversion

Habarisoft released version 6.1.0 of its RTF to HTML5 and XHTML converter library, ScroogeXHTML for the Java™ platform. The new version resolves 2 bugs and introduces 4 enhancements and new features, including support for table row height and text format changes within hyperlinks.

You can evaluate the new release with the online converter demo, which displays the configuration property values of the converter, and allows to modify many of them.

scrooge_portrait_logo_2016

 

ScroogeXHTML 6.0.1: merged table cells, Android™ platform support

Habarisoft released version 6.0.1 of its RTF to HTML5 and XHTML converter library, ScroogeXHTML for the Java™ platform. This version adds merged cell support for RTF table conversion, and easier usage on the Android platform.

Unbenannt

A short introduction to major changes is available on the ScroogeXHTML home page, in the Getting Started (PDF documentation), in the API documentation, and in this blog post.

You can evaluate the final release with the online converter demo, which now displays the configuration property values of the converter, and allows to modify many of them.

scrooge_portrait_logo_2016