Four Js Genero Report Writer
FourJs.Report.Runtime.BrowserViewer Class Reference

Class for configuring output for viewing in a browser. More...

Inheritance diagram for FourJs.Report.Runtime.BrowserViewer:
FourJs.Report.Runtime.LayoutedPagesConsumer

Public Types

enum  FontFileFormat { ttf, woff, eot }
 

Public Member Functions

 BrowserViewer ()
 Creates a BrowserViewer object. More...
 

Static Public Attributes

static String legalCopyright = Version.CLASS_COPYRIGHT
 

Properties

String documentDirectory [get, set]
 Specifies the directory in which the document will be generated Please note that the directory should be empty or non existent in which case it will be created during report generation. More...
 
String fontDirectory [get, set]
 Specifies the directory in which web fonts will be placed. Please note that it must be possible to refer from document directory to this directory by means of a relative path so that the two directories may not for example be on separate drives. More...
 
FontFileFormat fontFileFormat [get, set]
 Sets the web font file format format argument. More...
 

Detailed Description

Class for configuring output for viewing in a browser.

Compatibility

The output requires a browser with activated Java Script, the capability to render SVG 1.2 Tiny and support for web fonts in the formats "ttf", "eot" or "woff" (This is the case for Gecko (Firefox), WebKit (Chrome, Safari, Qt) and IE 10)

Architecture & Setup

For each report the engine produces a document tree in a directory specified by {link #setDocumentDirectory(String)}. The web viewer application (viewer.html) needs to be hosted on the same server in the "../../viewer" directory. The URL should then point to viewer.html and the parameter "reportId" should be set to the last path item of the document directory. Example: String reportsRoot="/var/www/reports"; // this directory is publicly visible as "http://www.4js.com/reports". String viewerDirectory=reportsRoot+"/viewer"; // not used. "viewer.html" needs to be in this directory. String documentsDirectory=reportsRoot+"/documents"; String fontsDirectory=reportsRoot+"/fonts"; String uuid=java.uti.UUD.randomUUID().toString(); // yields something like "57e96d13-05bc-408f-8ca1-9e6a2eab374e"

BrowserViewer.setDocumentDirectory(documentsDirectory+"/"+uuid) BrowserViewer.setFontDirectory(fontDirectory);

String url="http://www.4js.com/reports/viewer/viewer.html?reportId="+uuid;

//For a J2SE application we could launch the browser as follows java.awt.Desktop().getDesktop().browse(new java.net.URI(url));

Fonts

All fonts seen by the JVM on the platform are supported. The command line utility com.fourjs.report.main.FontInfo can be used to obtain a full list of supported fonts. Since web font files can be large the engine supports creating them in a separate directory that is shared among several documents (see {lin #setFontDirectory(String)}. This allows both the web server and the browser to cache the fonts across documents.

Rendering fidelity

If the browser supports web fonts the rendering is pixel exact.

Printing

Lifecycle

Documents are bookmarkable and remain viewable until the document directory is removed by the application. In other words, it is up to the application to remove documents that are no longer needed.

Processing large documents

The delay between input and output is one page and the browser viewer application takes advantage of that displaying the pages immediately. Documents not containing "Page N of M" paginations exhibit nearly constant memory consumption while documents containing them have a linear consumption of about 20 KB per page. The paginations do not interfere with the streaming since a referencing mechanism is used to update the paginations at the end of a block when the total number of pages is known. Please not that printing will be delayed for pages containing such forward references until they are resolved. This delaying has no impact on memory consumption as the pages are stored on disk.

Limitations

The web viewer does not currently support the termination of a report from the browser viewer application.

Constructor & Destructor Documentation

FourJs.Report.Runtime.BrowserViewer.BrowserViewer ( )

Creates a BrowserViewer object.

Property Documentation

String FourJs.Report.Runtime.BrowserViewer.documentDirectory
getset

Specifies the directory in which the document will be generated Please note that the directory should be empty or non existent in which case it will be created during report generation.

String FourJs.Report.Runtime.BrowserViewer.fontDirectory
getset

Specifies the directory in which web fonts will be placed. Please note that it must be possible to refer from document directory to this directory by means of a relative path so that the two directories may not for example be on separate drives.

FontFileFormat FourJs.Report.Runtime.BrowserViewer.fontFileFormat
getset

Sets the web font file format format argument.