Hi folks, I'm upgrading my FOP version from 0.20 up to 0.95 and I'm getting two problems.
The first one, and most important, is that I can't generate barcodes with Apache FOP and Barcode4j projects. I don't know why but I'm getting this error: javax.xml.transform.TransformerException: org.xml.sax.SAXException: Mismatch: page-sequence (http://www.w3.org/1999/XSL/Format) vs. root (http://www.w3.org/1999/XSL/Format) I know that this error uses to be a follow-up error but I have no more detail and I'm lost since I have reached a strange situation. I have the following code on my xslt. - Definition: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt" xmlns:svg="http://www.w3.org/2000/svg" extension-element-prefixes="barcode"> - Template: <xsl:template match="[EMAIL PROTECTED]'CODIGO_BARRAS']"> <fo:block> <fo:instream-foreign-object> <xsl:variable name="barcode-cfg"> <barcode> <code128> <human-readable>none</human-readable> <height>5mm</height> <quiet-zone enabled="false"/> </code128> </barcode> </xsl:variable> <xsl:copy-of select="barcode:generate($barcode-cfg, .)"/> </fo:instream-foreign-object> </fo:block> </xsl:template> - Call example: <texto class="CODIGO_BARRAS" text-align="left" font-size="12pt" module="0.45" height="10" >D106696</texto> - Java code: The following code throws the exception. public void convertXmlToPdf(final StreamSource xmlSource, final String xsl, final OutputStream pdf) throws Exception { FOUserAgent foUserAgent = instance.fopFactory.newFOUserAgent(); // todo, configure urls. foUserAgent.setBaseURL("file:///C:/TRIBUTOS/apps/gt_ear/build/gt_ear/gt_web/"); foUserAgent.setFontBaseURL("file:///C:/TRIBUTOS/apps/gt_ear/build/gt_ear/gt_web/"); foUserAgent.setAuthor("Miguel Tablado"); //Setup XSLT Fop fop = instancia.fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, pdf); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xsl)); // ParĂ¡metro PATH de las imagenes transformer.setParameter("AG_XSLFO_PATH_IMAGES", AGFunciones.agregarProtocoloFile(AGConfig.get("VirtualDirTemplates")) + "/images"); //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(xmlSource, res); } The following one creates the .fo file with no problems. private void convertXML2FO(final StreamSource src, final String xslt) throws IOException, TransformerException , FOPException { //Setup output final File fo = new File(AGConfig.get("writeXmlFoPdfIntoFile")); final OutputStream out = new FileOutputStream(fo); try { //Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(new StreamSource(xslt)); // ParĂ¡metro PATH de las imagenes transformer.setParameter("AG_XSLFO_PATH_IMAGES", AGFunciones.agregarProtocoloFile(AGConfig.get("VirtualDirTemplates")) + "/images"); //Resulting SAX events (the generated FO) must be piped through to FOP Result res = new StreamResult(out); //Start XSLT transformation and FOP processing transformer.transform(src, res); } finally { out.close(); } } The .fo generated snippet is something like this: <fo:block> <fo:instream-foreign-object> <svg:svg height="1.3316mm" viewBox="0 0 120.54 1.3316" width="120.54mm"> <svg:g style="fill:black; stroke:none"> <svg:rect height="1.3316" width="0.42" x="0" y="0"/> <svg:rect height="1.3316" width="0.21" x="0.63" y="0"/> ... <svg:rect height="1.3316" width="0.42" x="120.12" y="0"/> </svg:g> </svg:svg> </fo:instream-foreign-object> </fo:block> Trying to find out the original problem I have tried two things, the first one is to replace Barcode4j call to svg code. Any problem, the resultant pdf has a pretty barcode. The second one, that follows me to the second problem mentioned at introduction, has been configuring logs to get more information, but I didn't get success. I'm logging with Bea Weblogic 8.1 SP 5 system logs whose are java.util.logging and they are printing on FOP Exceptions, but not INFO logs. How can I configure them to succeed? Java properties are setted and it doesn't work, I tryied to filter logs, but there is no special handler... Many thanks, and excuse me for the text! Miguel. -- View this message in context: http://www.nabble.com/Problems-with-Apache-FOP-and-Barcode4j-tp19069996p19069996.html Sent from the FOP - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
