|
Re: PHP Integration - Printing [message #730941 is a reply to message #730812] |
Thu, 29 September 2011 15:00 |
|
Karvesh,
Do you mean the print on server button or the normal print button?
Jason
On 9/29/2011 4:45 AM, karvesh wrote:
> Dear Jason
>
> I have been using BIRT integrated with php with no problem so far. For
> the moment, when it comes to printing, i have to export the report to
> pdf, download it and then send it to printer.
> I was wondering if there is another way to send it for printing in one
> click just like in the birt report viewer?
> Any help here would be the most welcomed
>
> Thanking you in advance
>
> Karvesh
|
|
|
|
Re: PHP Integration - Printing [message #731006 is a reply to message #730955] |
Thu, 29 September 2011 17:00 |
|
Karvesh,
The Web Viewer essentially does the same thing except instead of
downloading it, it just renders to a byte array output stream, which it
then sends to some print utility classes to print it. Do you already
have code for sending it to the printer?
Jason
On 9/29/2011 11:30 AM, karvesh wrote:
> Dear Jason
>
> I mean the normal print button.
> I mean a way to print the report with all the page layout settings page
> by page instead of a single html flush
> Thanks
> Karvesh
|
|
|
|
Re: PHP Integration - Printing [message #731296 is a reply to message #731112] |
Fri, 30 September 2011 14:27 |
|
The viewer does this using AJAX calls back to the server that retrieves
a pdf to print. Maybe you could use javascript to call php page like
the one below:
<?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->setOutputFormat("pdf");
$task->setRenderOption( $taskOptions );
$task->run();
$task->close();
} catch (JavaException $e) {
echo $e; //"Error Calling BIRT";
}
//echo $outputStream;
echo java_values($outputStream->toByteArray());
?>
But instead of echoing the pdf stream send it to the printer?
Jason
On 9/29/2011 10:48 PM, karvesh wrote:
> Dear Jason
>
> Currently i have a javascript function that simply pushes the iframe
> content (that is the html display of the report) to the printer.
> Unfortunately the formatting is poor and the page setup defined in the
> master page layout during design time (like page width, height, etc) are
> lost.
>
> Is there a better way to do it? You mentioned something about a code..
> Could you please hint me here?
>
> Thanking you in advance
>
> Karvesh
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03633 seconds