From: Aaron T. <ata...@zi...> - 2005-12-22 19:32:37
|
I wanted to let the list know that we were finally able to get the = barcode extension working, but we may not be able to use it. Our situation was that we could generate barcodes within FOP if invoked = from the console and we could generate barcodes as images within the = appserver, but using FOP within the appserver gave us no barcodes and no = errors. The problem seems to be some kind of mismatch between the fop.jar, = batik.jar, and barcode4j.jar. Unfortunately you can no longer download = the versions of fop or batik that were used in creating the barcode4j = jar files, maybe fop-0.20.5-patch2 and batik version 1.51. I tried = compiling the barcode4j code against the the older jars we have already, = fop-0.20.5 and batik-1.5, that has some insurmountable problems. So I = downloaded and tried using the current versions, fop-0.20.5-patch3 and = batik-1.6, and after getting past some of the obvious errors we = evenutally get to some bizarre runtime exceptions about method = signatures not matching (when clearly they passed the compiler AND = looking at the method and the calling code it seems to match). So to = check if we can get barcode4j working within our appserver we copied the = fop.jar and batik.jar from the barcode4j source lib directory, = overwriting our previous versions, and barcodes come out just fine. =20 Unfortunately since we changed these versions it seems many other things = are just off. Margins and scales seems to be wrong (e.g. you specify = 1.0in and you often get about 1.2in), SVG renderings that previously = spanned an entire 8.5in page now are only 7.5ins, they are not major = issues and could be accounted for but they are counter-intuitive AND = we'd have to change many pages. Are these bugs in the version of fop = that is used or is it something else on our side? -----Original Message----- From: Jeremias Maerki [mailto:de...@je...]=20 Sent: Tuesday, November 22, 2005 12:00 PM To: bar...@li... Subject: Re: [Barcode4j-users] Using FOP extension from a web app Ok, so you're Benny Anderson's colleague, judging from the e-mail = address. :-)=20 Looks like a really tricky thing. To your question: I've already told = Benny Anderson my ideas: http://sourceforge.net/mailarchive/forum.php?thread_id=3D9027683&forum_id= =3D38496 But I guess it hasn't helped, yet. There are no facilities to turn on = logging especially for the ElementMapping. The only thing you can do is = to add System.out statement in the FOP and Barcode4J source code and = recompile it. Another idea I just had is trying FOP's example servlet = found in the examples/servlet directory in the 0.20.5 distribution. That = reduces the webapp to a minimum and should provide a reference point = against your own webapp. Benny Anderson said you're working on Linux. If = you have a Windows box around, please try the same there. Maybe it's a = problem with the JDK in use, or maybe it's something with the web = container. What web container are you using, BTW? I'm sorry that I'm not able to help you more. If you solve this please = let me know the solution. That you don't get any error messages at all = is very disturbing because until now I've always received an error = message if the Barocde4J Namespace is used in an FO document and FOP did = not recognize the barcode extension. The only work-around is to use the Xalan or SAXON extension during the = XSLT stage to convert the barcode to an SVG graphic. Since for PDF = Barcode4J does the same internally there's no performance penalty. Good luck! On 22.11.2005 20:09:34 Aaron Tavistock wrote: > We're trying to get barcode4j working with our existing application=20 > which acts as a xsl-fo to PDF translator. This part works fine, the=20 > xsl-fo is generated dynamically based on user requests and they get=20 > the results as a PDF file. >=20 > Now we're trying to add some barcodes and barcode4j looks great,=20 > except we can't get it to integrate seemlessly. We can generate a=20 > barcode from the command line and we can generate a barcode as an=20 > image using the the JavaBean within the app server. Unfortunately,=20 > using the FOP extension is failing with no errors, no debug, and no=20 > results, we still get ALL the content outside the = instream-foreign-object, just no barcodes. >=20 > My first thought was that there is a classloader issue with the=20 > META-INF/services directory. So I found the method for adding these=20 > by hand using driver.addElementMapping(ElementMapping) and added an=20 > instance of org.krysalis.barcode4j.fop0205.BarcodeElemenetMapping. =20 > This compiles (so the classes are clearly in the classpath) but there=20 > is no change, the results include all fop content except the barcode. >=20 > Heres a snippet of the code: >=20 >=20 > ByteArrayOutputStream out =3D=20 > new ByteArrayOutputStream(); > =20 > InputSource in =3D=20 > new InputSource(new ByteArrayInputStream(rawContent)); > =20 > ElementMapping barcodeMapping =3D=20 > new BarcodeElementMapping(); >=20 > Driver driver =3D new Driver(); > driver.setRenderer(Driver.RENDER_PDF); > driver.setLogger(logger); > driver.setInputSource(input); > driver.setOutputStream(out); > driver.addElementMapping(barcodeMapping) > driver.run(); >=20 > byte[] content =3D out.toByteArray(); >=20 >=20 > First, does anyone have any ideas on resolving this? >=20 > Second, is there a way to turn on explicit debuging for this element=20 > mapping? Our logs show FOP starting, processing, and stopping as if=20 > there are no problems but theres no indication that the barcode=20 > mapping was accessed. >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. Get Certified Today=20 > Register for a JBoss Training Course. Free Certification Exam for All = > Training Attendees Through End of 2005. For more info visit: > http://ads.osdn.com/?ad_idv28&alloc_id=16845&op=CCk > _______________________________________________ > Barcode4j-users mailing list > Bar...@li... > https://lists.sourceforge.net/lists/listinfo/barcode4j-users Jeremias Maerki |