xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Mansour <omans...@clever-age.com>
Subject Re: png renderer and multiples page
Date Wed, 08 Nov 2006 08:42:43 GMT

Le 6 nov. 06 à 14:55, Jeremias Maerki a écrit :

> Creating multiple PNG files is only supported if output is done to a
> file (seems to be the case here). In this case, you have to set the
> output file on the user agent in addition to the output stream:
>
> useragent.setOutputFile(new File("D:/out.png"));

I have added this line after getting my user agent (with  
newFOUserAgent()) :

$file_out = new Java ('java.io.File', $path_to_png);
$fop_ua->setOutputFile($file_out);

I have now an error on my transform action :
java.lang.Exception: Invoke failed: [o(TransformerImpl)]->transform 
((Source)o(StreamSource), (Result)o(SAXResult)). Cause:  
javax.xml.transform.TransformerException:  
java.lang.NullPointerException Responsible VM: 1.5.0_08@http:// 
java.sun.com/ at  
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform 
(TransformerImpl.java:651) at  
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform 
(TransformerImpl.java:281) at  
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at  
sun.reflect.NativeMethodAccessorImpl.invoke 
(NativeMethodAccessorImpl.java:39) at  
sun.reflect.DelegatingMethodAccessorImpl.invoke 
(DelegatingMethodAccessorImpl.java:25) at  
java.lang.reflect.Method.invoke(Method.java:585) at  
php.java.bridge.JavaBridge.Invoke(JavaBridge.java:1073) at  
php.java.bridge.Request.handleRequest(Request.java:499) at  
php.java.bridge.Request.handleRequests(Request.java:544) at  
php.java.bridge.JavaBridge.run(JavaBridge.java:178) at  
php.java.bridge.BaseThreadPool$Delegate.run(BaseThreadPool.java:37)  
Caused by: javax.xml.transform.TransformerException:  
java.lang.NullPointerException ... 11 more Caused by:  
java.lang.NullPointerException at  
org.apache.fop.render.bitmap.PNGRenderer.stopRenderer 
(PNGRenderer.java:123) at  
org.apache.fop.area.RenderPagesModel.endDocument 
(RenderPagesModel.java:240) at  
org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java: 
357) at org.apache.fop.fo.FOTreeBuilder.endDocument 
(FOTreeBuilder.java:170) at  
com.sun.org.apache.xml.internal.serializer.ToXMLSAXHandler.endDocument 
(ToXMLSAXHandler.java:182) at  
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endDocument 
(AbstractSAXParser.java:769) at  
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.endEntity 
(XMLDocumentScannerImpl.java:560) at  
com.sun.org.apache.xerces.internal.impl.XMLEntityManager.endEntity 
(XMLEntityManager.java:1779) at  
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load 
(XMLEntityScanner.java:1758) at  
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipSpaces 
(XMLEntityScanner.java:1274) at  
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl 
$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:1247) at  
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s 
canDocument(XMLDocumentFragmentScannerImpl.java:368) at  
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse 
(XML11Configuration.java:834) at  
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse 
(XML11Configuration.java:764) at  
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse 
(XMLParser.java:148) at  
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse 
(AbstractSAXParser.java:1242) at  
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformId 
entity(TransformerImpl.java:560) at  
com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform 
(TransformerImpl.java:642) ... 10 more



an idea ?

>
> HTH
>
> On 04.11.2006 18:00:09 Olivier Mansour wrote:
>> Hey
>>
>>
>> Another beginner question
>>
>> I use fop 0.92 but I'am consedreing moving to trunk soon
>>
>> I tried to generate png from a fo file
>>
>> using command line works fine :
>>   java -jar fop.jar -fo /tmp/test.fo -png ../../../web/uploads/ 
>> test.png
>>
>> give severals png test.png, test2.png - one png for each page.
>>
>> I am now trying using the API trought php-java-bridge (quite similar
>> if we where using java)
>>
>> here my code :
>>
>> 	      // Instanciate & configure FOP user agent
>>                $fop_factory = new JavaClass
>> ('org.apache.fop.apps.FopFactory');
>>                $fop_factory = $fop_factory->newInstance();
>>                $fop_factory->setUserConfig(new Java('java.io.File',
>> sfConfig::get('sf_app_config_dir').'/fop.xconf'));
>>                $fop_ua = $fop_factory->newFOUserAgent();
>>
>>                 /*
>>                 * Setup output stream.  Note: Using  
>> BufferedOutputStream
>>                 * for performance reasons (helpful with
>> FileOutputStreams).
>>                 */
>>                $out = new Java('java.io.FileOutputStream',
>> $path_to_png);
>>                $out = new Java('java.io.BufferedOutputStream', $out);
>>
>>                // Construct fop with desired output format
>>                $fop_mime_constants = new JavaClass
>> ('org.apache.fop.apps.MimeConstants');
>>                $fop = $fop_factory->newFop($fop_mime_constants-
>>> MIME_PNG, $fop_ua, $out);
>>
>>                // Setup JAXP using identity transformer
>>                $transformer_factory = new JavaClass
>> ('javax.xml.transform.TransformerFactory');
>>                $transformer_factory = $transformer_factory-
>>> newInstance();
>>                $transformer = $transformer_factory->newTransformer();
>>
>>                // Setup input stream
>>                $src = new Java
>> ('javax.xml.transform.stream.StreamSource', $path_to_fo);
>>
>>                // Resulting SAX events (the generated FO) must be
>> piped through to FOP
>>                $res = new Java('javax.xml.transform.sax.SAXResult',
>> $fop->getDefaultHandler());
>>
>>                // Start XSLT transformation and FOP processing
>>                $transformer->transform($src, $res);
>>
>> the problem is just the first png is generated  ! :-(
>>
>> An idea ?
>>
>> Thank you for your advices and making fop wich is great
>>
>> Olivier
>>
>>
>> --
>> Olivier Mansour      http://www.clever-age.com
>> Clever Age Lyon - conseil en architecture technique
>> GSM: +33 6 11 03 23 77  Tél: +33 4 78 89 46 45
>>
>> Clever Age vous invite à ses petits déjeuners du Jeudi
>> http://www.clever-age.com/actualites/petits-dejeuners/
>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>



--
Olivier Mansour      http://www.clever-age.com
Clever Age Lyon - conseil en architecture technique
GSM: +33 6 11 03 23 77  Tél: +33 4 78 89 46 45

Clever Age vous invite à ses petits déjeuners du Jeudi
http://www.clever-age.com/actualites/petits-dejeuners/



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Mime
View raw message