Java-Object
| From: | Bedilu Habte | Date: | Mon, 29 Apr 2002 09:09:20 +0000 |
| Subject: | Java-Object | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95119@lists.php.net to get a copy of this message | ||
Hi everyone,
I use the apache FOP tool to transform & render an XML-XSL pair to a PDF.
The following code shows my trial to perform the transformation and
rendering
within a php-script.
<?php
1. $trtool = new Java("de.smc.util.PDFTransformer");
2. $result = $trtool->renderXmlXsl('data.xml', 'style.xsl');
3. if (!$result) {
4. die("Cannot process PDF-tarnsformation!");
5. }
6. Header("Content-type: application/pdf\nContent-Length: " .
strlen($result));
7. print $result;
8. $fo = "result.pdf";
9. $fp = fopen($fo, "w+");
10. fwrite($fp, $result);
11. fclose($fp);
?>
It appears that the transformation and rendering is performed without errors
( according to
the System-output). However, in the context I used, $result contains the 6
characters
'Object' which was supposed to contain the pdf document.
NB.: 1. de.smc.util.PDFTransformer is a custom class that uses FOP.
2. renderXmlXsl(xml,xsl) returns a java.io.ByteArrayInputStream.
Any idea on how to extract the content out of a Java-Object in php?
hoping...