i want to generate QRCodes for my pdfs unsing fop-servlet as tomcat webapp.
so far i am using
i can produce code39 codes. this is the code i am using at the moment to generate my code39 barcode:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format"; xmlns:java="http://xml.apache.org/xslt/java"; exclude-result-prefixes="java" xmlns:barcode="org.krysalis.barcode4j.xalan.BarcodeExt" extension-element-prefixes="barcode"> <!-- ..... --> <fo:block text-align="end"> <fo:instream-foreign-object> <xsl:variable name="barcode-cfg"> <barcode> <code39> <height>113.5mm</height> <!-- wide-factor>6.75</wide-factor --> <module-width>0.3mm</module-width> <interchar-gap-width>4mw</interchar-gap-width> <quite-zone enabled="true">30mw</quite-zone> <human-readable> <placement>none</placement> </human-readable> </code39> </barcode> </xsl:variable> <xsl:copy-of select="barcode:generate($barcode-cfg, /Order/ticket/id)" /> </fo:instream-foreign-object> </fo:block> <!-- .... -->
i get a pdf with code39 barcode, works pretty well since many years.
i now want to generate qrcodes. i have installed barcode4j trunk (svn version 372). run ant and copied the barcode4j jars in my lib dir
together with zxing-core-1.7.jar
with the following code i can generate an qrcode and code39 barcode (with the default params)
i get a pdf with both barcodes
<fo:block text-align="end"> <fo:instream-foreign-object> <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns"; message="123123" > <barcode:qr/> </barcode:barcode> </fo:instream-foreign-object> <fo:instream-foreign-object> <barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns"; message="123123" > <barcode:code39> </barcode:code39> </barcode:barcode> <!-- </xsl:variable> <xsl:copy-of select="barcode:generate($barcode-cfg, /Order/ticket/id)" /> --> </fo:instream-foreign-object> </fo:block>
BUT i can not define any options like height, width etc.
when i try to use
<barcode:barcode xmlns:barcode="http://barcode4j.krysalis.org/ns"; message="123123" > <barcode:code39> <height>45mm</height> </barcode:code39> </barcode:barcode>
i get a blank page, even with <barcode:height>. no pdf is generated! </barcode:height>
what is missing? why can't i set any options to generate the barcode?
as a work-a-round i am using fo:external-graphic with a http-call to get a qrcode image to insert in my pdf. but i want to go the way without external-praphic and use barcode4j
Thank you
Markus