[prev in list] [next in list] [prev in thread] [next in thread]
List: xsl-list
Subject: Re: [xsl] Using barcode markup in Saxon/Oxygen
From: "Kevin Brown" <kevin () renderx ! com>
Date: 2012-09-23 17:42:23
Message-ID: 063601cd99b2$c9e949b0$5dbbdd10$ () com
[Download RAW message or body]
> What about support for QR codes and other matrix barcodes?
If when processing your data you are internet connected then I would just
use the Google Chart API for QR Codes. Easy enough to build out the URL
which dynamically generates them. Note: this is from the series of CoolTools
for FO I posted to RenderX web site long ago, I have not examined whether
the links to the Google API has changed. The full template I posted includes
many more of the Google Chart API components (pie chart, pin with letter,
sticky note, outline text). I would be happy to send it along to whomever
would like it.
Refer to:
https://developers.google.com/chart/infographics/docs/qr_codes
Let's say your XML is like this:
<qrcode size="200x200">
<line>This is an example of encoding http://www.renderx.com</line>
</qrcode>
With something like this:
<xsl:template match="qrcode">
<xsl:variable name="url">
<xsl:call-template name="build.qrcode">
<xsl:with-param name="size" select="@size"/>
<xsl:with-param name="text" select="line"/>
</xsl:call-template>
</xsl:variable>
<fo:block space-before="12pt">
<fo:external-graphic src="url({$url})" />
</fo:block>
</xsl:template>
<xsl:template name="build.qrcode">
<xsl:param name="size" select="'300x300'"/>
<xsl:param name="text" select="'http://www.renderx.com'"/>
<!-- Add Chart Server URL -->
<xsl:value-of select="$chartserver"/>
<!-- Add Chart Type -->
<xsl:text>?cht=qr</xsl:text>
<!-- Start the parameters -->
<xsl:text>&chs=</xsl:text>
<!-- Add the size -->
<xsl:value-of select="$size"/>
<xsl:text>&chl=</xsl:text>
<!-- Add the text -->
<xsl:value-of select="url:encode($text)"/>
</xsl:template>
Kevin Brown
RenderX
kevin@renderx.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe@lists.mulberrytech.com>
--~--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic