Subject: Re: Using barcode markup in Saxon/Oxygen
From: "Kevin Brown" <kevin@xxxxxxxxxxx>
Date: Sun, 23 Sep 2012 10:42:23 -0700
|
> 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@xxxxxxxxxxx
| Current Thread |
|
Kevin Brown - 22 Sep 2012 05:36:47 -0000
Kevin Brown - 23 Sep 2012 17:43:01 -0000 <=
|
|