In conjunction with fixing the DHL label issue, I ran into formating
limitations with the current version that ofBiz is using of FOP. So I jumped in and got it working. The new FOP is NOT backwards compatible and they dropped several of the classes that were being used. They went to a new factory framework. I managed to get the ofbiz\framework\widget\src\org\ofbiz\widget\screenScreenFopPdfViewHandler working. I started updating ofbiz\framework\webapp\src\org\ofbiz\webapp\view\foprenderer.java (pretty much the same code...) but I didn't see where it was being used. I placed some breakpoints in the code but when viewing PDFs it never enters the code. Some help here? The newer libraries are more sensitive to the FO schema and some of the existing templates broke (i.e. viewInvoice.fo.ftl) which I corrected. The problem there was that there were some spacer <table-row> elements with no <fo:table-cell> and <fo:table-cell> with no <fo:block> elements which are now required. The newer libraries also require upgrades of a few of the libraries that they use including: avalon-framework-4.2.0.jar batik-all-1.6.jar commons-io-1.1.jar commons-logging-1.0.4.jar serializer-2.7.0.jar xalan-2.7.0.jar xercesImpl-2.7.1.jar xml-apis-1.3.02.jar xmlgraphics-commons-1.0.jar I'm looking for feedback and help with foprenderer.java before I send in my changes. John |
Hi John,
this is a great news. The FopRenderer class is used by the org.ofbiz.webapp.view.ScreenFopPdfViewHandler class (line 58). Hope this helps, Jacopo John Martin wrote: > In conjunction with fixing the DHL label issue, I ran into formating > limitations with the current version that ofBiz is using of FOP. So I > jumped in and got it working. > > The new FOP is NOT backwards compatible and they dropped several of > the classes that were being used. They went to a new factory > framework. > > I managed to get the > ofbiz\framework\widget\src\org\ofbiz\widget\screenScreenFopPdfViewHandler > working. > > I started updating > ofbiz\framework\webapp\src\org\ofbiz\webapp\view\foprenderer.java > (pretty much the same code...) but I didn't see where it was being > used. I placed some breakpoints in the code but when viewing PDFs it > never enters the code. Some help here? > > The newer libraries are more sensitive to the FO schema and some of > the existing templates broke (i.e. viewInvoice.fo.ftl) which I > corrected. The problem there was that there were some spacer > <table-row> elements with no <fo:table-cell> and <fo:table-cell> with > no <fo:block> elements which are now required. > > The newer libraries also require upgrades of a few of the libraries > that they use including: > > avalon-framework-4.2.0.jar > batik-all-1.6.jar > commons-io-1.1.jar > commons-logging-1.0.4.jar > serializer-2.7.0.jar > xalan-2.7.0.jar > xercesImpl-2.7.1.jar > xml-apis-1.3.02.jar > xmlgraphics-commons-1.0.jar > > I'm looking for feedback and help with foprenderer.java before I send > in my changes. > > John |
At lines 58-59, I see
ScreenRenderer screens = new ScreenRenderer(writer, null, htmlScreenRenderer); screens.populateContextForRequest(request, response, servletContext); This does not call the FopRenderer class. As far as I can see, it isn't being used. All of the FO generation was implemented in the ScreenFopPdfViewHandler class. --- Secondly, there appears to be issues with Barcode4J not working. I'm getting this error in the log: 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting object http://barcode4j.krysalis.org/ns^barcode 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting object http://barcode4j.krysalis.org/ns^code39 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting object http://barcode4j.krysalis.org/ns^height 78536103[ LineLayoutManager.java:377:WARN ] Line 1 of a paragraph overflows the available area. (fo:block, location: 189/43) I had read that Barcode4J was to be upgraded in Jan 06 but I haven't found the update. http://xmlgraphics.apache.org/fop/trunk/upgrading.html : "Extensions and Renderers written for version 0.20.5 will not work with the new code! The new FOP extension for Barcode4J will be available in January 2006." Looking at the http://barcode4j.krysalis.org/changes.html site, it doesn't appear any changes have been done to the library since 2004. Accessing the site has also been very problematic. Any suggestions? John |
John,
sorry, I ment org.ofbiz.webapp.view.FopPdfViewHandler; at line 56 I have: ByteArrayOutputStream out = null; try { out = FopRenderer.render(writer); } catch (GeneralException e) { throw new ViewHandlerException(e.getMessage(), e.getNested()); } Jacopo John Martin wrote: > At lines 58-59, I see > > ScreenRenderer screens = new ScreenRenderer(writer, null, > htmlScreenRenderer); > screens.populateContextForRequest(request, response, > servletContext); > > This does not call the FopRenderer class. > > As far as I can see, it isn't being used. All of the FO generation > was implemented in the ScreenFopPdfViewHandler class. > > --- > > Secondly, there appears to be issues with Barcode4J not working. I'm > getting this error in the log: > > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^barcode > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^code39 > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^height > 78536103[ LineLayoutManager.java:377:WARN ] Line 1 of a paragraph > overflows the available area. (fo:block, location: 189/43) > > I had read that Barcode4J was to be upgraded in Jan 06 but I haven't > found the update. > http://xmlgraphics.apache.org/fop/trunk/upgrading.html : > > "Extensions and Renderers written for version 0.20.5 will not > work with the new > code! The new FOP extension for Barcode4J will be available in > January 2006." > > Looking at the http://barcode4j.krysalis.org/changes.html site, it > doesn't appear any changes have been done to the library since 2004. > Accessing the site has also been very problematic. > > Any suggestions? > > John |
In reply to this post by John Martin
John,
about the barcode problem... I don't know how to help but maybe there will be others that will reply to this message because I know there are other persons in this list interested in the FOP upgrade (e.g. Christian Geisert) Jacopo John Martin wrote: > At lines 58-59, I see > > ScreenRenderer screens = new ScreenRenderer(writer, null, > htmlScreenRenderer); > screens.populateContextForRequest(request, response, > servletContext); > > This does not call the FopRenderer class. > > As far as I can see, it isn't being used. All of the FO generation > was implemented in the ScreenFopPdfViewHandler class. > > --- > > Secondly, there appears to be issues with Barcode4J not working. I'm > getting this error in the log: > > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^barcode > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^code39 > 78536087[ElementMappingRegistry.java:147:WARN ] Unknown formatting > object http://barcode4j.krysalis.org/ns^height > 78536103[ LineLayoutManager.java:377:WARN ] Line 1 of a paragraph > overflows the available area. (fo:block, location: 189/43) > > I had read that Barcode4J was to be upgraded in Jan 06 but I haven't > found the update. > http://xmlgraphics.apache.org/fop/trunk/upgrading.html : > > "Extensions and Renderers written for version 0.20.5 will not > work with the new > code! The new FOP extension for Barcode4J will be available in > January 2006." > > Looking at the http://barcode4j.krysalis.org/changes.html site, it > doesn't appear any changes have been done to the library since 2004. > Accessing the site has also been very problematic. > > Any suggestions? > > John |
In reply to this post by Jacopo Cappellato
As for FopPdfViewHandler, I only found one reference to it in the
application/content/webapp/content/WEB-INF/controller.xml <handler name="fop" type="view" class="org.ofbiz.webapp.view.FopPdfViewHandler"/> <view-map name="fonts.fo" page="/fonts.fo.ftl" type="fop"/> I checked the entire code base and didn't find a single reference to fonts.fo outside the definition in the controller.xml. There were a few references to fonts.fo.xml but I couldn't find any connection. It really appears to me that FopPdfViewHandler is never used. John |
In reply to this post by John Martin
Good news on the Barcode4J. I found that Jeremias Maerki released a
beta that works with version .92. The jar is available at: . http://www.jeremias-maerki.ch/download/fop/barcode4j-fop-ext-trunk-complete.jar I swapped out the jars and restarted ofBiz and the barcodes are working! John |
In reply to this post by John Martin
John,
thanks for looking at this: you are completely right. Don't worry about the two classes, they will be probably removed (if no one will be against this) after that I'll commit soon the screen widget version of the fonts.fo report. Thanks, Jacopo fonts.pdf John Martin wrote: > As for FopPdfViewHandler, I only found one reference to it in the > application/content/webapp/content/WEB-INF/controller.xml > > <handler name="fop" type="view" > class="org.ofbiz.webapp.view.FopPdfViewHandler"/> > <view-map name="fonts.fo" page="/fonts.fo.ftl" type="fop"/> > > I checked the entire code base and didn't find a single reference to > fonts.fo outside the definition in the controller.xml. There were a > few references to fonts.fo.xml but I couldn't find any connection. It > really appears to me that FopPdfViewHandler is never used. > > > John |
In reply to this post by Jacopo Cappellato
Jacopo Cappellato schrieb:
> John, > > about the barcode problem... I don't know how to help but maybe there > will be others that will reply to this message because I know there are > other persons in this list interested in the FOP upgrade (e.g. Christian > Geisert) Yes I'm still very interested but don't have much time currently (our second daughter was born 14 days ago) And it sounds like the barcode problem is already solved ;-) Christian |
I believe that it is all working and I'll check it in. People using
PDF's are going to need to review their fo templates for the new required elements and to size their graphics with the content-height/content-width tags. Rendering of images are now done at their "natural" size unless you use the properties content-width or content-height. The height and width attributes don't seem to have any effect on the rendering." |
Free forum by Nabble | Edit this page |