|
From: <php...@li...> - 2010-05-27 21:12:55
|
Hi,
I'm having trouble when I try to generate pdf by JasperReports using
php-java-bridge.
export to file works
fine: $exportManager->exportReportToPdfFile($jasperPrint, $outputFileName);
but export to stream to save on browser don't work:
----------------------------------------------
$javaOutputStream = new java("java.io.ByteArrayOutputStream");
$exportManager->exportReportToPdfStream($jasperPrint, $javaOutputStream);
header('Cache-Control: ');
header('Expires: ');
header('Content-Transfer-Encoding: binary');
header('Content-Type: application/pdf');
header('Content-disposition: attachment; filename="output.pdf"');
print $javaOutputStream->toByteArray();
----------------------------------------------
the file generated by the second option is almost equal to first option...
but some binary data is broken on stream.
I'm thinking that the binary data is broken because of the conversion
between php and java.
the two files are attached.
Do vimdiff outputToFile.pdf outputToStream.pdf
tks.
|