function __wakeup() { $buf = new java("java.io.ByteArrayInputStream", base64_decode($this->serialID)); $in = new java("java.io.ObjectInputStream", $buf); $this->java = $in->readObject(); $in->close(); }
function getOutputFormat($format) { $fmt = null; switch ($format) { case "pdf": $fmt = new java("org.eclipse.birt.report.engine.api.PDFRenderOption"); $fmt->setOutputFormat("pdf"); header("Content-type: application/pdf"); break; case "html": $fmt = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption"); $fmt->setOutputFormat("html"); $ih = new java("org.eclipse.birt.report.engine.api.HTMLServerImageHandler"); $fmt->setImageHandler($ih); header("Content-type: text/html"); break; case "msword": $fmt = new java("org.eclipse.birt.report.engine.api.RenderOption"); $fmt->setOutputFormat("doc"); header("Content-type: application/msword"); break; case "xls": $fmt = new java("org.eclipse.birt.report.engine.api.RenderOption"); $fmt->setOutputFormat("xls"); header("Content-type: application/vnd.ms-excel"); break; default: die("unknown output format {$format}"); } return $fmt; }
function createWorkbook2($name, $dx, $dy) { $wb = new java("org.apache.poi.hssf.usermodel.HSSFWorkbook"); $sheet = $wb->createSheet("new sheet"); $row = $sheet->createRow(0); //Aqua background $style = $wb->createCellStyle(); $aqua = new java('org.apache.poi.hssf.util.HSSFColor$AQUA'); $style->setFillBackgroundColor($aqua->index); $style->setFillPattern($style->BIG_SPOTS); $cell = $row->createCell(1); $cell->setCellValue("X"); $cell->setCellStyle($style); //Orange "foreground", foreground being the fill foreground not the font color. $orange = new java('org.apache.poi.hssf.util.HSSFColor$ORANGE'); $style->setFillForegroundColor($orange->index); $style->setFillPattern($style->SOLID_FOREGROUND); java_begin_document(); for ($x = 0; $x < $dx; $x++) { $row = $sheet->createRow($x); for ($y = 0; $y < $dy; $y++) { $cell = $row->createCell($y); $cell->setCellValue("{$x} . {$y}"); $cell->setCellStyle($style); } } java_end_document(); // Write the output to a file $fileOut = new java("java.io.FileOutputStream", $name); $wb->write($fileOut); $fileOut->close(); }
public static function autoFitTableToWindow($dataDir) { //ExStart //ExFor:Table.AutoFit //ExFor:AutoFitBehavior //ExId:FitTableToPageWidth //ExSummary:Autofits a table to fit the page width. // Open the document $doc = new java("com.aspose.words.Document", $dataDir . "TestFile.doc"); $nodeType = java("com.aspose.words.NodeType"); $table = $doc->getChild($nodeType->TABLE, 0, true); // Autofit the first table to the page width. $autoFitBehavior = new Java("com.aspose.words.AutoFitBehavior"); $table->autoFit($autoFitBehavior->AUTO_FIT_TO_WINDOW); // Save the document to disk. $doc->save($dataDir . "TestFile.AutoFitToWindow Out.doc"); //ExEnd $preferredWidthType = new Java("com.aspose.words.PreferredWidthType"); if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getType()) == java_values($preferredWidthType->PERCENT)) { echo "PreferredWidth type is not percent <br />"; } if (java_values($doc->getFirstSection()->getBody()->getTables()->get(0)->getPreferredWidth()->getValue()) == 100) { echo "PreferredWidth value is different than 100 <br />"; } }
public function getParam() { $parameters = new java('java.util.HashMap'); $parameters->put('HEADER_REPORT', 'Inversiones 2021, C.A. <br/> Listado de Productos'); $parameters->put('REPORT_LOCALE', new Java('java.util.Locale', 'es', 'VE')); return $parameters; }
public function getParam() { $parameters = new java('java.util.HashMap'); $parameters->put('TITLE', 'LISTADO DE MUNICIPIOS DE VENEZUELA'); $parameters->put('HEADER_REPORT', 'INSTITUTO DE ESTUDIOS GEOPOLITICOS'); $parameters->put('REPORT_LOCALE', new Java('java.util.Locale', 'es', 'VE')); return $parameters; }
function dump_java_exception($ex) { $trace = new java("java.io.ByteArrayOutputStream"); echo "Java Exception in File '" . $ex->getFile() . "' Line:" . $ex->getLine() . " - Message: " . $ex->getCause()->toString(); $cause = $ex->getCause(); $cause->printStackTrace(new java("java.io.PrintStream", $trace)); echo "<PRE>Java Stack Trace:\n" . $trace->toString() . "\n</PRE>"; }
public function getParam() { //parametros del reporte $parameters = new java('java.util.HashMap'); $parameters->put('URL_IMG', realpath('header.jpg')); $parameters->put('HEADER_REPORT', 'Inversiones 2021, C.A. <br/> Listado de Productos'); $parameters->put('REPORT_LOCALE', new Java('java.util.Locale', 'es', 'VE')); return $parameters; }
/** create a temporary directory for the lucene index files. Make sure * to create the tmpdir from Java so that the directory has * javabridge_tmp_t Security Enhanced Linux permission. Note that PHP * does not have access to tempfiles with java_bridge_tmp_t: PHP * inherits the rights from the HTTPD, usually httpd_tmp_t. */ function create_index_dir() { global $tmp_file, $tmp_dir; $javaTmpdir = java("java.lang.System")->getProperty("java.io.tmpdir"); $tmpdir = java_values($javaTmpdir); $tmp_file = tempnam($tmpdir, "idx"); $tmp_dir = new java("java.io.File", "{$tmp_file}.d"); $tmp_dir->mkdir(); return java_values($tmp_dir->toString()); }
function init() { $this->frame = $frame = new java("javax.swing.JFrame", "SwingApplication"); $frame->setDefaultcloseOperation($frame->EXIT_ON_CLOSE); $contents = $this->createComponents(); $contentPane = $frame->getContentPane(); $BorderLayout = new JavaClass("java.awt.BorderLayout"); $contentPane->add($contents, $BorderLayout->CENTER); $frame->pack(); }
public static function createChildren($parent, $childrenPerLevel, $levelsMore) { for ($i = 0; $i < $childrenPerLevel; $i++) { $properties = new java("java.util.HashMap"); $properties->put("i", $i); $properties->put("level", $levelsMore + 1); $node = self::$inserter->createNode($properties); self::$inserter->createRelationship($parent, $node, java("org.neo4j.graphdb.DynamicRelationshipType")->withName("PARENT"), null); if ($levelsMore > 0) { self::createChildren($node, $childrenPerLevel, $levelsMore - 1); } } }
/** * @inheritdoc */ public function populateWithFieldData(FillPdfFormInterface $pdf_form, array $field_mapping, array $context) { /** @var FileInterface $original_file */ $original_file = File::load($pdf_form->file->target_id); $pdf_data = file_get_contents($original_file->getFileUri()); $fields = $field_mapping['fields']; $require = drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc'; require_once DRUPAL_ROOT . '/' . $require; try { $fillpdf = new \java('com.ocdevel.FillpdfService', base64_encode($pdf_data), 'bytes'); foreach ($fields as $key => $field) { if (substr($field, 0, 7) == '{image}') { // Remove {image} marker. $image_filepath = substr($field, 7); $image_realpath = $this->fileSystem->realpath($image_filepath); $fillpdf->image($key, $image_realpath, 'file'); } else { $fillpdf->text($key, $field); } } } catch (\JavaException $e) { drupal_set_message(java_truncate((string) $e), 'error'); return NULL; } try { if ($context['flatten']) { $populated_pdf = java_values(base64_decode($fillpdf->toByteArray())); } else { $populated_pdf = java_values(base64_decode($fillpdf->toByteArrayUnflattened())); } } catch (\JavaException $e) { drupal_set_message(java_truncate((string) $e), 'error'); return NULL; } return $populated_pdf; }
public function __construct($storage, $transport, $repository = null) { /* $this->JRrepository = new Java("org.apache.jackrabbit.rmi.repository.URLRemoteRepository","http://localhost:8080/rmi"); return; */ if (isset($repository)) { $this->JRrepository = $repository; } else { if ($transport == 'webdav') { $factory = new java("com.day.crx.jcr.davex.Client", $storage); $this->JRrepository = $factory->getRepository(); } else { if ($transport == 'davex') { $client = new java("ch.liip.jcr.davex.DavexClient", $storage); $this->JRrepository = $client->getRepository(); } else { $factory = new Java("org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"); $this->JRrepository = $factory->getRepository($storage); } } } }
function createDocument($jndiname, $serverArgs) { // find initial context $initial = new java("javax.naming.InitialContext", $serverArgs); try { // find the service $objref = $initial->lookup("{$jndiname}"); // access the home interface $home = java("javax.rmi.PortableRemoteObject")->narrow($objref, java("DocumentHome")); if (java_is_null($home)) { throw new Exception("home"); } // create a new remote document and return it $doc = $home->create(); } catch (JavaException $ex) { $cause = $ex->getCause(); echo "Could not create remote document. Have you deployed documentBean.jar?<br>\n"; echo "{$cause} <br>\nin file: {$ex->getFile()}<br>\nline:{$ex->getLine()}\n"; exit(1); } return $doc; }
#!/usr/bin/php <?php include_once "java/Java.inc"; $ar = array(1, 2, 3, 5, 7, 11, -13, -17.01, 19); unset($ar[1]); $v = new java("java.util.Vector", $ar); $Arrays = new java_class("java.util.Arrays"); $l = $Arrays->asList($ar); $v->add(1, null); $l2 = $v->sublist(0, $v->size()); echo java_cast($l, "S") . "\n" . java_cast($l2, "S") . "\n"; $res1 = java_values($l); $res2 = java_values($l2); $res3 = array(); $res4 = array(); $i = 0; foreach ($v as $key => $val) { $res3[$i++] = java_values($val); } for ($i = 0; $i < java_values($l2->size()); $i++) { $res4[$i] = java_values($l2[$i]); } if (!$l->equals($l2)) { echo "ERROR\n"; exit(1); } if (java_values($l[1]) != null || (string) $res3 != (string) $res1 || (string) $res4 != (string) $res1) { echo "ERROR\n"; exit(2); }
#!/usr/bin/php <?php include_once "java/Java.inc"; $here = realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) { $here = getcwd(); } // must succeed echo "must succeed\n"; java_require("{$here}/noClassDefFound.jar;{$here}/doesNotExist.jar"); $v = new java("NoClassDefFound"); $v->call(null);
<body bgcolor = "#FFFFFF" text = "#000000"> <?php //define("JAVA_DEBUG", true); //调试设置 define("JAVA_RECV_SIZE", 8192); //define("JAVA_HOSTS", "127.0.0.1:8080"); //设置javabridge监听端口,如果开启javabridge.jar设置的端口不是8080,可通过此语句更改 require_once("java/Java.inc"); //php调用java的接口,必须的 $here=realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) $here=getcwd(); java_set_library_path("$here/lib"); //设置java开发包位置 java_set_file_encoding("GBK"); //设置java编码 $client=new java("com.bocom.netpay.b2cAPI.BOCOMB2CClient"); $ret=$client->initialize("C:/bocommjava/ini/B2CMerchant.xml"); //初始化配置文件 $ret = java_values($ret); if ($ret != "0") { $err=$client->getLastErr(); //为正确显示中文对返回java变量进行转换,如果用java_set_file_encoding进行过转换则不用再次转换 //$err = java_values($err->getBytes("GBK")); $err=java_values($err); print "初始化失败,错误信息:" . $err . "<br>"; exit(1); } $rep=$client->queryAccountBalance(); if (java_is_null($rep))
$sortOrder=1; //1:降序;2:升序 $code=""; $err=""; $msg=""; $begTime=$_REQUEST["begTime"]; $endTime=$_REQUEST["endTime"]; $flag=(integer)$_REQUEST["flag"]; $begIndex=(integer)$_REQUEST["begIndex"]; $begOrder=$_REQUEST["begOrder"]; $endOrder=$_REQUEST["endOrder"]; $sortField=$_REQUEST["sortField"]; $sortOrder=$_REQUEST["sortOrder"]; //生成java对象 $client=new java("com.bocom.netpay.b2cAPI.BOCOMB2CClient"); //初始化相关配置 $ret=$client->initialize("C:/bocommjava/ini/B2CMerchant.xml"); $ret = java_values($ret); if ($ret != "0") { $err=$client->getLastErr(); //为正确显示中文对返回java变量进行转换,如果用java_set_file_encoding进行过转换则不用再次转换 //$err = java_values($err->getBytes("GBK")); $err=java_values($err); print "初始化失败,错误信息:" . $err . "<br>"; exit (1); } //发主机交易
<?php include_once "java/Java.inc"; ini_set("max_execution_time", 0); $here = realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) { $here = getcwd(); } $binaryData = new java("BinaryData"); $data = java_values($binaryData->getData(700 * 1024)); for ($i = 0; $i < 10; $i++) { $data = java_values($binaryData->compare($data)); $str1 = substr($data, 255, 256); } $str = '&;a&"e""&&&;;"'; $binaryData->b = '&;a&"e""&&&;;"'; $binaryData->compare('&;a&"e""&&&;;"'); if ($str != java_values($binaryData->toString())) { echo "ERROR\n"; exit(1); } $data = java_values($binaryData->getData(1024)); if (strlen($data) != 1024) { echo "ERROR\n"; exit(5); } $s1 = substr(java_values($binaryData->toString()), 0, 256); $binaryData->b = $str1; $s2 = substr(java_values($binaryData->toString()), 0, 256); if ($s1 != $s2) { echo "ERROR\n";
{ return array(new JavaClass("org.xml.sax.EntityResolver"), new JavaClass("org.xml.sax.DTDHandler"), new JavaClass("org.xml.sax.DocumentHandler"), new JavaClass("org.xml.sax.ErrorHandler")); } // Create an instance of HandlerBase which implements the above // interfaces. function createHandler() { return java_closure(new HandlerBase(), null, getInterfaces()); } // Standard SAX handling $ParserFactory = new JavaClass("javax.xml.parsers.SAXParserFactory"); $parser = $ParserFactory->newInstance()->newSaxParser()->getParser(); $handler = createHandler(); $parser->setDocumentHandler($handler); $parser->setErrorHandler($handler); $parser->setFeature("http://apache.org/xml/features/validation/schema", false); $parser->setFeature("http://xml.org/sax/features/namespaces", false); $parser->setFeature("http://xml.org/sax/features/validation", false); $parser->setFeature("http://xml.org/sax/features/namespace-prefixes", false); $parser->setFeature("http://apache.org/xml/features/validation/schema-full-checking", false); // capture the HTML output of phpinfo .. // ob_start(); // phpinfo(); // $in = new java("java.io.ByteArrayInputStream", ob_get_contents()); // ob_end_clean(); $here = getcwd(); $in = new java("java.io.FileInputStream", "{$here}/phpinfo.xml"); // and filter it through the above callbacks $inputSource = new java("org.xml.sax.InputSource", "{$here}/DTD"); $inputSource->setByteStream($in); $parser->parse($inputSource);
#!/usr/bin/php <?php include_once "java/Java.inc"; $conversion = new java("java.util.Properties"); $conversion->put("long", "java.lang.Byte java.lang.Short java.lang.Integer"); $conversion->put("boolean", "java.lang.Boolean"); $conversion->put("double", "java.lang.Double"); $conversion->put("null", "null"); $conversion->put("object", "depends"); $conversion->put("array of longs", "int[]"); $conversion->put("array of doubles", "double[]"); $conversion->put("array of boolean", "boolean[]"); $conversion->put("mixed array", ""); foreach ($conversion as $key => $value) { echo "{$key} => " . java_cast($value, "S") . "\n"; }
#!/usr/bin/php <?php include_once "java/Java.inc"; $ListClass = new java_class("java.util.ArrayList"); $list = new java("java.util.ArrayList"); $list->add(0); $list->add("one"); $list->add(null); $list->add(new java("java.lang.Object")); $list->add(new java("java.lang.Long", 4)); $list->add($list); // the list now contains itself $list->add(new java("java.lang.String", "last entry")); foreach ($list as $key => $value) { echo "{$key} => "; if ($value instanceof java) { if (java_instanceof($value, $ListClass)) { // second argument may also be an instance of a class if (!java_instanceof($value, $list)) { exit(1); } echo "[I have found myself!] \n"; } else { echo "[found java object: " . java_cast($value, "S") . "] \n"; } } else { echo "{$value}\n"; } }
#!/usr/bin/php <?php include_once "java/Java.inc"; $sys = new java("java.lang.System"); $sys->setProperty("utf8", "Cześć! -- שלום -- Grüß Gott -- Dobrý deň -- Dobrý den -- こんにちは, コンニチハ"); $arr = $sys->getProperties(); foreach ($arr as $key => $value) { print $key . " -> " . java_values($value) . "<br>\n"; } ?>
<?php header("Content-type: application/pdf"); header("Content-Disposition: attachment; filename=downloaded.pdf"); define("JAVA_HOSTS", "127.0.0.1:8080"); define("JAVA_SERVLET", "/JavaBridge/JavaBridge.phpjavabridge"); require_once "java/Java.inc"; session_start(); $here = getcwd(); $ctx = java_context()->getServletContext(); $birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx); java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook()); try { $report = $birtReportEngine->openReportDesign("{$here}/TopNPercent.rptdesign"); $task = $birtReportEngine->createRunAndRenderTask($report); $taskOptions = new java("org.eclipse.birt.report.engine.api.PDFRenderOption"); $outputStream = new java("java.io.ByteArrayOutputStream"); $taskOptions->setOutputStream($outputStream); $taskOptions->setOption("pdfRenderOption.pageOverflow", "pdfRenderOption.fitToPage"); $taskOptions->setOutputFormat("pdf"); $task->setRenderOption($taskOptions); $task->run(); $task->close(); } catch (JavaException $e) { echo $e; //"Error Calling BIRT"; } //echo $outputStream; echo java_values($outputStream->toByteArray());
$out = 'out.html'; if ($exportType == "PDF") { java_set_file_encoding("ISO-8859-1"); $contentType = "application/pdf"; // export Pdf $out = $root . "/output.pdf"; java("net.sf.jasperreports.engine.JasperExportManager")->exportReportToPdfFile($print, $out); } elseif ($exportType == "HTML") { // export Pdf $out = $root . "/output.Html"; $contentType = "text/Html"; java("net.sf.jasperreports.engine.JasperExportManager")->exportReportToHtmlFile($print, $out); } elseif ($exportType == "Excel") { $out = $root . "/output.xls"; $contentType = "application/vnd.ms-excel"; $xlsExporter = new java("net.sf.jasperreports.engine.export.JRXlsExporter"); $JRXlsExporterParameter = java("net.sf.jasperreports.engine.export.JRXlsExporterParameter"); $xlsExporter->setParameter($JRXlsExporterParameter->JASPER_PRINT, $print); $xlsExporter->setParameter($JRXlsExporterParameter->OUTPUT_FILE, new java("java.io.File", $out)); //$xlsExporter->setParameter($JRXlsExporterParameter->IS_WHITE_PAGE_BACKGROUND, true); $xlsExporter->exportReport(); } header("Content-type: " . $contentType); readfile($out); //unlink($out); } catch (Exception $ex) { echo "<b>Error...:</b>" . $ex->getCause(); } echo "done"; } ?>
<body bgcolor = "#FFFFFF" text = "#000000"> <?php //define("JAVA_DEBUG", true); //调试设置 //define("JAVA_HOSTS", "127.0.0.1:8080"); //设置javabridge监听端口,如果开启javabridge.jar设置的端口不是8080,可通过此语句更改 require_once("java/Java.inc"); //php调用java的接口,必须的 $here=realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) $here=getcwd(); java_set_library_path("$here/lib"); //设置java开发包路径 java_set_file_encoding("GBK"); //设置java编码 $orders=$_REQUEST["orders"]; $client=new java("com.bocom.netpay.b2cAPI.BOCOMB2CClient"); $ret=$client->initialize("C:/bocommjava/ini/B2CMerchant.xml"); $ret = java_values($ret); if ($ret != "0") { $err=$client->getLastErr(); //为正确显示中文对返回java变量进行转换,如果用java_set_file_encoding进行过转换则不用再次转换 //$err = java_values($err->getBytes("GBK")); $err=java_values($err); print "初始化失败,错误信息:" . $err . "<br>"; exit(1); } $rep=$client->queryOrder($orders); //批量订单查询 if (java_is_null($rep))
#!/usr/bin/php <?php include_once "java/Java.inc"; function x1($s1, $o1) { echo "c1: {$s1}, {$o1}\n"; return 1; } function c2($b) { return !java_values($b); } $here = realpath(dirname($_SERVER["SCRIPT_FILENAME"])); if (!$here) { $here = getcwd(); } java_require("{$here}/../tests.php5/callback.jar"); $closure = java_closure(null, array("c1" => "x1"), java("Callback")); $callbackTest = new java('Callback$Test', $closure); if ($callbackTest->test()) { echo "test okay\n"; exit(0); } else { echo "test failed\n"; exit(1); }
$out = 'out.html'; if ($exportType == "PDF") { java_set_file_encoding("ISO-8859-1"); $contentType = "application/pdf"; // export Pdf $out = $root . "/output.pdf"; java("net.sf.jasperreports.engine.JasperExportManager")->exportReportToPdfFile($print, $out); } elseif ($exportType == "HTML") { // export Pdf $out = $root . "/output.Html"; $contentType = "text/Html"; java("net.sf.jasperreports.engine.JasperExportManager")->exportReportToHtmlFile($print, $out); } elseif ($exportType == "Excel") { $out = $root . "/output.xls"; $contentType = "application/vnd.ms-excel"; $xlsExporter = new java("net.sf.jasperreports.engine.export.JRXlsExporter"); $JRXlsExporterParameter = java("net.sf.jasperreports.engine.export.JRXlsExporterParameter"); $xlsExporter->setParameter($JRXlsExporterParameter->JASPER_PRINT, $print); $xlsExporter->setParameter($JRXlsExporterParameter->OUTPUT_FILE, new java("java.io.File", $out)); $xlsExporter->setParameter($JRXlsExporterParameter->IS_DETECT_CELL_TYPE, true); $xlsExporter->setParameter($JRXlsExporterParameter->IS_IGNORE_GRAPHICS, true); // $xlsExporter->setParameter($JRXlsExporterParameter->IS_WHITE_PAGE_BACKGROUND, true); $xlsExporter->exportReport(); } header("Content-type: " . $contentType); readfile($out); // unlink($out); } catch (Exception $ex) { echo "<b>Error...:</b>" . $ex->getCause(); } echo "done";
#!/usr/bin/php <?php include_once "java/Java.inc"; $v = new java("java.util.Vector"); $v->setSize(10); foreach ($v as $key => $val) { $v[$key] = $key; } foreach ($v as $key => $val) { echo java_values($val); } echo "\n"; for ($i = 0; $i < 10; $i++) { echo java_values($v[$i]); } echo "\n"; if (java_values($v[9]) == 9) { echo "test okay\n"; exit(0); } else { echo "ERROR\n"; exit(1); }
* php report.php >helloBirt.html * */ // the report file to render $myReport = "test.rptdesign"; // load resources, .rpt files and images from the current working dir $here = getcwd(); $ctx = java_context()->getServletContext(); $birtReportEngine = java("org.eclipse.birt.php.birtengine.BirtEngine")->getBirtEngine($ctx); java_context()->onShutdown(java("org.eclipse.birt.php.birtengine.BirtEngine")->getShutdownHook()); // Create a HTML render context $renderContext = new java("org.eclipse.birt.report.engine.api.HTMLRenderContext"); $renderContext->setBaseImageURL("{$here}/images"); $contextMap = new java("java.util.HashMap"); $CONTEXT = java("org.eclipse.birt.report.engine.api.EngineConstants")->APPCONTEXT_HTML_RENDER_CONTEXT; $contextMap->put($CONTEXT, $renderContext); // Load the report design $design = $birtReportEngine->openReportDesign("{$here}/{$myReport}"); $task = $birtReportEngine->createRunAndRenderTask($design); $task->setAppContext($contextMap); // Add HTML render options $options = new java("org.eclipse.birt.report.engine.api.HTMLRenderOption"); $options->setOutputFormat($options->OUTPUT_FORMAT_HTML); // Create the output $out = new java("java.io.ByteArrayOutputStream"); $options->setOutputStream($out); $task->setRenderOption($options); $task->run(); $task->close(); // Return the generated output to the client echo java_values($out);