Subject: fo to Intermediate Format transform - Image file
locked after transformation / Fop

Hi,   I try to convert a fo file to Intermediate Format (IF) file with a fop server (i.e. JVM never terminate)  fo file contain an external-graphics jpg image. The problem  : at the end of FO2IF transformation, the file signature.jpg remain locked by java.   This problem donât happen with fo to pdf transformation. This problem donât happen with fop used with command line because java terminate and close all files. I join you a (FO2IF.log and FO2PDF.log)   I use version Fop Trunk 1447488   Feb 11 2013   This is my FO source file   <?xml version="1.0" encoding="utf-8"?><fo:root xmlns:fo=""> <fo:layout-master-set><fo:simple-page-master master-name="section1" page-width="8.268in" page-height="11.693in" margin-top="35.4pt" margin-bottom="35.4pt" margin-right="70.85pt" margin-left="70.85pt"><fo:region-body margin-top="35.45pt" margin-bottom="35.45pt" /></fo:simple-page-master></fo:layout-master-set><fo:page-sequence master-reference="section1" format="1"> <fo:flow flow-name="xsl-region-body">   <fo:block><fo:inline><fo:external-graphic src="" /></fo:inline></fo:block>   </fo:flow></fo:page-sequence></fo:root>       This is my java source file   ... Source inputSource = new StreamSource( new File(inputFilename) ); //FO file File outputFile = new File(outputFilename);  //IF file convertFromIntermediate(inputSource, outputFile, mimeType); // MimeConstants.MIME_PDF or MimeConstants.MIME_AFP for RendererMimic ...     /** * Converts an XSL-FO document to an intermediate file. * @param src the source file * @param intermediate the target intermediate file * @param mimeType the MIME type of the final document * @throws IOException In case of an I/O problem * @throws FOPException In case of a FOP problem * @throws TransformerException In case of a XSL transformation problem */ public void convertToIntermediate(Source src, File intermediate, String mimeType)     throws IOException, FOPException, TransformerException {     FopRunner.trace("Converting to intermediate format...");     //Create a user agent     FOUserAgent userAgent = fopFactory.newFOUserAgent();       //Create an instance of the target document handler so the IFSerializer     //can use its font setup     FopRunner.trace("MIME Type = " + mimeType);     IFDocumentHandler targetHandler = userAgent.getRendererFactory().createDocumentHandler(userAgent, mimeType);       //Create the IFSerializer to write the intermediate format     IFSerializer ifSerializer = new IFSerializer(new IFContext(userAgent));       //Tell the IFSerializer to mimic the target format      ifSerializer.mimicDocumentHandler(targetHandler);       //Make sure the prepared document handler is used     userAgent.setDocumentHandlerOverride(ifSerializer);       // Setup output     OutputStream out = new;     out = new;         try     {         // Construct FOP (the MIME type here is unimportant due to the override         // on the user agent)         Fop fop = fopFactory.newFop(null, userAgent, out);           // Setup XSLT         TransformerFactory factory = TransformerFactory.newInstance();         Transformer transformer = factory.newTransformer();                 // Resulting SAX events (the generated FO) must be piped through to FOP         Result res = new SAXResult(fop.getDefaultHandler());           // Start XSLT transformation and FOP processing         transformer.transform(src, res);     }     finally     {         out.close();     } }    


Christian Pestel


Description: Zip compressed data

To unsubscribe, e-mail: fop-users-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx
For additional commands, e-mail: fop-users-help@xxxxxxxxxxxxxxxxxxxxxx