code java dans des pages php
Sur un projet existant, php/mysql, il devait afficher des reports, sur un fichier.php ils ont mis le code suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| require_once("java/Java.inc");
$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{
if (isset($_SESSION['IMP']))
$reportName=$_SESSION['IMP'];
else
$reportName="Nondisponible";
$report = $birtReportEngine->openReportDesign("${here}/report/${reportName}.rptdesign");
$task = $birtReportEngine->createRunAndRenderTask($report);
$taskOptions = new java("org.eclipse.birt.report.engine.api.PDFRenderOption");
$outputStream = new java("java.io.ByteArrayOutputStream");
$task->setParameterValue("id", new java("java.lang.String", $_SESSION['iddossier']));
require 'connection.php';
$task->getAppContext()->put("foo1", $encoded_data);
$task->getAppContext()->put("odaURL", "jdbc:mysql://".$serveur.":3306/".$base."");
$task->getAppContext()->put("odaUser",$admin);
$task->getAppContext()->put("odaPassword", $mdp);
$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());
?> |
quand je voulais testet et afficher les page, il me dit impossible de charger le fichier pdf, j'ai suit un peu les liens j'ai trouvé ce fichier mais plein de lignes rouges que dois je ajouer comme lib pour ne plus avoir ces lignes inconnu ?