ScroogeXHTML for the Java™ platform 6.0: new features

The upcoming 6.0 release of ScroogeXHTML for the Java™ platform introduces useful new features. Here is a short overview:

Embedding images with HTML Data URI scheme

The traditional MemoryPictureAdapter class in ScroogeXHTML for the Java platform generates image link elements which point to a resource location <img src=”…”>. This keeps the document small, but requires making the image resources accessible for the web browser at the given location.

In some cases however, it is useful to embed the whole image in-line in the web page as if they were external resources.

The new MemoryPictureAdapterBase64 class returns Data URIs for small JPEG and PNG images. By default, the size threshold is set to 32 kB.

Usage example:

scrooge = new ScroogeXHTML();
scrooge.setConvertPictures(true);
PictureAdapter adapter = new MemoryPictureAdapterBase64();
scrooge.setPictureAdapter(adapter);

The new class inherits from the old MemoryPictureAdapter, and will return the inherited result for images which exceed the size limit.

Data URIs are fully supported by most major browsers, and partially supported in Internet Explorer and Microsoft Edge.

Event listeners for DOM post processing

The converter internally uses a XML DOM tree to create the HTML document structure. Before converting the DOM to the result HTML5 String, the converter calls a sequence of post processing handlers, which apply optimizations and custom modifications on the DOM tree. Post processing handlers must implement the PostProcessListener interface.

The converter stores the event handlers in its PostProcessListeners property which is a list of PostProcessListener implementations. By default, the converter library creates and assigns post process handlers to perform these tasks

  • strip empty (whitespace-only) text nodes
  • strip empty span nodes
  • strip attribute-less span nodes
  • replace empty paragraph (<p>) nodes with <br> nodes

These default PostProcessListener implementations are located in the com.habarisoft.scroogexhtml.tidy package and use XPath to perform the DOM modification (see Stack Overflow example code).

Application code may create and add more post process listeners as needed.

On-line demo

The new demo page https://www.scroogexhtml.com/sxd6snap/ allows to upload and convert RTF files.

scrooge_portrait_logo_2016

ScroogeXHTML for the Java™ platform 6.0 – RTF to HTML5 converter preview

Habarisoft released the first public preview of version 6.0 of its RTF to HTML5 converter library, ScroogeXHTML for the Java™ platform.

Major changes

  • only HTML5 and XHTML will be supported  – for other markup language versions, ScroogeXHTML 5.X is still available
  • new DOM based post processing event listeners
  • new support for embedded JPEG and PNG images with HTML Data URI scheme
  • improved support for RTF tables
  • improved support for monospace fonts
  • improved conversion of \footnote
  • improved support for \listtable (paragraph numbering)

Continue reading

ScroogeXHTML for the Java™ platform 5.5 – RTF to HTML5 converter

Habarisoft released version 5.5 of its RTF to HTML5 converter library, ScroogeXHTML for the Java™ platform. This is mainly a maintenance release.

Important changes

  • The converter does no longer generate span tags without attributes <span>text<span>
  • Fixed incorrect values of the ISO 8601 time stamp in the meta date header
  • Improved handling of empty font names, the converter now uses the specified default font instead of the ‘first’ font in the font replace list

Continue reading

Daraja Framework 1.0 released

Daraja Framework is a new free open source library for Object Pascal (Free Pascal 2.6.4, Free Pascal 3.0, Delphi 2009+) available on GitHub. It is based on the stand-alone HTTP server in Internet Direct (Indy) and the successor to the Habari Web Components library by Habarisoft.

Continue reading

Free Open Source Logging Facade for Object Pascal 0.1.0-alpha released

SLF4P is a simple logging facade for Object Pascal, tested with Delphi 2009 / DUnit and Free Pascal 2.6.4 / FPCUnit and 3.0, inspired by SLF4J.
The source code contains bindings to the Log4D logging framework, a SimpleLogger and a NOPLogger implementation. DUnit and FPCUnit test projects are included. Wiki with usage example: https://github.com/michaelJustin/slf4p/wiki

Current release: 0.1.0-alpha