Four Js Genero Report Writer
|
Class for configuring output for viewing in a browser. More...
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... | |
Class for configuring output for viewing in a browser.
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)
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));
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.
If the browser supports web fonts the rendering is pixel exact.
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.
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.
The web viewer does not currently support the termination of a report from the browser viewer application.
FourJs.Report.Runtime.BrowserViewer.BrowserViewer | ( | ) |
Creates a BrowserViewer object.
|
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.
|
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.
|
getset |
Sets the web font file format format
argument.