RE: barcode generation with FOP
"O'Neill, Ciaran" <Ciaran.O'[email protected]> Fri, 23 Apr 2004 14:22:09 +0100
| Newsgroups | gmane.comp.krysalis.user |
|---|---|
| Message-ID | <C86D15453EF3D6118B0700508BAE64C623255D@exc-dub1> |
I have the FOP extension in my classpath and I have gotten it to work with
the following code (i'm using version krysalis-barcode-0.9 BTW).
I am, however having trouble getting some of the settings working - my
wide-factor below doesn't seem to do anything. I want my barcode to be
wider (changing the height works fine), and I also get errors when I turn
the human-readable off.
Have you got any suggestions please? Is this the way I should be working
with it, or should I be using the FOP example I provided in the previous
mail?
Would it help if I attached my source XML and XSL?
TIA for any help,
Ciaran.
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:barcode="org.krysalis.barcode.xalan.BarcodeExt"
xmlns:common="http://exslt.org/common"
xmlns:xalan="http://xml.apache.org"
exclude-result-prefixes="barcode common xalan">
.....
<fo:block>
<fo:instream-foreign-object>
<xsl:variable name="barcd">
<xsl:value-of select="manifest-no" />
</xsl:variable>
<xsl:variable name="barcode-cfg">
<barcode>
<msg><xsl:value-of select="manifest-no" /></msg>
<code128>
<wide-factor>4</wide-factor>
<height>13mm</height>
</code128>
</barcode>
</xsl:variable>
<xsl:variable name="bc" select="barcode:generate($barcode-cfg, $barcd)"/>
<svg:svg xmlns:svg="http://www.w3.org/2000/svg">
<svg:rect x="0mm" y="0mm" fill="white">
<xsl:attribute name="width"><xsl:value-of
select="$bc/svg:svg/@width"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of
select="$bc/svg:svg/@height"/></xsl:attribute>
</svg:rect>
<xsl:copy-of select="$bc"/>
</svg:svg>
</fo:instream-foreign-object>
</fo:block>
-----Original Message-----
From: Jeremias Maerki [mailto:[email protected]]
Sent: 23 April 2004 13:19
To: [email protected]
Cc: [email protected]
Subject: Re: barcode generation with FOP
Did you follow the instructions closely? It seems as if you don't have
the FOP extension in your classpath. Make sure you add the right JAR to
your classpath, the one with the FOP extension in it. You may have to
adjust the fop.bat file so the barcode extension really gets loaded.
On 21.04.2004 13:54:19 O'Neill, Ciaran wrote:
> Hi,
>
> I'm trying to get barcodes to appear on my PDF using Apache FOP.
>
> When I run fop with the barcodes in my XSL I get the following output.
>
>
############################################################################
> ##########################
> C:\Program Files\My Installs\Apache FOP\fop-0.20.5>fop -xml
> C:\MySaves\fo\udwmanifest\manifest.xml -xsl
> C:\MySaves\fo\udwmanifest\tmp.xsl -pdf C:\MySaves\fo\udwmanifest\test2.pdf
> [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
> [INFO] FOP 0.20.5
> [INFO] Using org.apache.xerces.parsers.SAXParser as SAX2 Parser
> [INFO] building formatting object tree
> [INFO] setting up fonts
> [ERROR] Unsupported element encountered: barcode (Namespace:
> http://www.krysalis.org/barcode/ns). Source context: unavailable
> [ERROR] Expected XSL-FO (root, page-sequence, etc.), SVG (svg, rect, etc.)
> or elements from another supported language.
> [ERROR] Unsupported element encountered: code128 (Namespace:
> http://www.krysalis.org/barcode/ns). Source context: unavailable
> [ERROR] Unsupported element encountered: height (Namespace:
> http://www.krysalis.org/barcode/ns). Source context: unavailable
> [INFO] [1]
> [ERROR] no handler defined for http://www.krysalis.org/barcode/ns:barcode
> foreign xml
> [INFO] [2]
> [ERROR] no handler defined for http://www.krysalis.org/barcode/ns:barcode
> foreign xml
> [INFO] [3]
> [ERROR] no handler defined for http://www.krysalis.org/barcode/ns:barcode
> foreign xml
> [INFO] Parsing of document complete, stopping renderer
>
> C:\Program Files\My Installs\Apache FOP\fop-0.20.5>
>
############################################################################
> ##########################
>
> My XSL declaration at the start si as follows:
> <xsl:stylesheet xmlns:fox="http://xml.apache.org/fop/extensions"
>
xmlns:print="http://www.jcatalog.com/com.jcatalog.output.xslextensions.print
> .PrintElementFactory" xmlns:fo="http://www.w3.org/1999/XSL/Format"
> version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:saxon="http://icl.com/saxon">
>
> Here is the section of code for the barcode:
>
############################################################################
> ##########################
> <fo:block-container position="absolute" top="29pt" left="434pt"
> height="27.0pt" width="118.0pt" border-width="1.0pt"
display-align="before">
> <fo:block>
> <fo:instream-foreign-object>
> <xsl:variable name="barcd">
> <xsl:value-of select="manifest-no" />
> </xsl:variable>
> <barcode:barcode xmlns:barcode="http://www.krysalis.org/barcode/ns"
> message="{$barcd}">
> <barcode:code128>
> <barcode:height>10mm</barcode:height>
> </barcode:code128>
> </barcode:barcode>
> </fo:instream-foreign-object>
> </fo:block>
> </fo:block-container>
>
############################################################################
> ##########################
>
> Could anyone lpease help me with this?
>
> TIA,
> Ciaran.
Jeremias Maerki
-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297
_______________________________________________
krysalis-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/krysalis-users
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
-------------------------------------------------------
This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek
For a limited time only, get FREE Ground shipping on all orders of $35
or more. Hurry up and shop folks, this offer expires April 30th!
http://www.thinkgeek.com/freeshipping/?cpg=12297