[PHP] Java-Object
Hi, First some info about my working environment: OS - Win2000 PHP - 4.1.1 Java - 1.3.1 (Apache - 1.3.22) > are you sure you did everything right with the java/php combination? did > you test that with other, easier things? I've modified the php.ini (and http.conf) to be able to call java from php. All the examples in the php-manual work correctly. > did you test the class on the command line with success? I am trying it first on the command line, though my aim is to use it later as a server side script as part of a project implemented mainly in php. > did you read the manual of everything that is involved in your task? I can't say I've read everything. I've read the java, classes/object sections, but such details are not provided in the manual. > i could only help you until now in finding out more about the data and > type of your object... Code snippet of the renderXmlXsl(string,string) method: public InputStream renderXmlXsl(String xmlSource, String xslSource) { ... /**HERE IS THE TRANSFORMATION*/ TraxTransform tt = new TraxTransform(); tt.transform(xmlSource, xslSource, stres); ... ByteArrayInputStream bis = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); /**HERE IS THE RENDERER TO PDF*/ Driver driver = new Driver(foFile, out); ... try { driver.run(); } catch (Exception ex) { ex.printStackTrace(); } byte[] content = out.toByteArray(); bis = new ByteArrayInputStream(content); ... /**RETURNED java.io.ByteArrayInputStream*/ return bis; } I think I made the problem clearer. kindly, Bedilu -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
AW: [PHP] Java-Object
Hallo Henning, thanks for your suggestion. The result... >print_r($result); resulted in: Objectjava Object ( [0] => 2 ) var_dump($result); had given me: object(java)(1) { [0]=> int(2) } Can you make something out of this. -Ursprungliche Nachricht- Von: Henning [mailto:[EMAIL PROTECTED]] Gesendet: Montag, 29. April 2002 11:40 An: Habte, Bedilu Betreff: Re: [PHP] Java-Object Bedilu Habte wrote: > 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. that just means that the variable contains data of type object > Any idea on how to extract the content out of a Java-Object in php? not exactly right now, i don't know nothing about the things you do there, but as much as i know of data handling and objects, you could maybe use print_r($result) or var_dump(result) to examine the data in your object, maybe the data you need is just some property of your object. take care if your pdf is really large, these commands result in dumping all the data of the variable on the screen... henning -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Java-Object
Hi Hassen, > Are you sure the method renderXmlXsl() returns the rendered document > ?, Yes, the method 'renderXmlXsl' performs the necessary transformation and rendering, after which it returns the pdf. It is in the custom class : de.smc.util.PDFTransformer and it has been tested outside php - as a java application. The problem here is how to extract the content of an Object. Methods that return java.lang.String and other java-primitive types return the corresponding values as a php-string. What if the method returns an InputStream? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Java-Object
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. 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... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php