|
From: <php...@li...> - 2010-05-31 14:45:59
|
Hi,
[please excuse the delay]
$javaOutputStream = new java("java.io.ByteArrayOutputStream");
$exportManager->exportReportToPdfStream($jasperPrint, $javaOutputStream);
java_set_file_encoding("UTF-8");
print ((string)$javaOutputStream->toByteArray());
The (string) cast above invokes a byte[] => String conversion using
the file encoding UTF-8. Since cp1252 is the codepage used by java,
the result is invalid PDF.
Please either avoid the byte[] => String conversion by using
java_cast() or please use java_set_file_encoding("cp1252")
Please change your code to
[...]
print (java_cast($javaOutputStream->toByteArray(), "string"));
Whether or not the (string) cast should avoid the conversion and
behave like java_cast() is another question. I think it should. But
before we change it, we'll have to check carefully if this won't break
compatibility. -- The __toString() method for proxy objects appeared
in PHP 5.2.0, so I think a change won't break too much code.
Thank you very much for reporting this issue.
Regards,
Jost Bökemeier
|