Output as Browser (PHP)

Set up and configure output to a browser from your reporting application. The Browser option provides high fidelity viewing. Silent printing is not available; you must use the Print function in your browser.

To output your report to a browser file, use the selectDevice("Browser") function and specify the browser settings.

For example:

# 'viewer' directory is a copy of <GRW_INSTALL_DIR>/gre/viewer on the web server
$GRE_REPORT_VIEWER_URL_PREFIX = "http://myserver/viewer";
$GRE_PRIVATE_URL_PREFIX = "http://myserver/private";
$GRE_PUBLIC_URL_PREFIX="http://myserver/public";
# If the 'private' directory doesn't exist on the web server, it is automatically created
$GRE_PRIVATE_DIR = "Path of the private directory on the web server";
# If the 'public' directory doesn't exist on the web server, it is automatically created
$GRE_PUBLIC_DIR = "Path of the public directory on the web server";

$greRunnerObj->selectDevice("Browser");
$uuid = uniqid();
$greRunnerObj->setBrowserDocumentDirectory($GRE_PRIVATE_DIR."/".$uuid);
$greRunnerObj->setBrowserFontDirectory($GRE_PUBLIC_DIR."/fonts");
$greRunnerObj->setBrowserDocumentDirectoryURL($GRE_PRIVATE_URL_PREFIX."/".$uuid);
$greRunnerObj->setBrowserFontDirectoryURL($GRE_PUBLIC_URL_PREFIX."/fonts");

$url = $GRE_REPORT_VIEWER_URL_PREFIX."/viewer.html?reportId=".$uuid."&privateUrlPrefix=".$GRE_PRIVATE_URL_PREFIX;

# Open the URL in a browser

For the full list of properties and methods, refer to the Genero Report Writer PHP API documentation.