Sunday, April 08, 2012

QR Codes in your documents

QR codes are one method to ease the information exchange between classical medias and mobile devices (common usage direct link to the corresponding web page in paper based catalogs, manuals, ....).

But how to create those QR codes without too much complexity?

Google Chart API provides:
  • chart wizard to create QR codes and corresponding styling
  • infographics API to create static images based on posted chart definition (URLs)
viola. You now have a easy to use backend for creation of QR codes using e.g XSL-T.

The following code is taken from "QR Codes in DTIA Output" which shows how to create QR codes for PDF output of the DITA-OT using XSL-FO:

<!-- Insert QR code -->
<xsl:template match="*[contains(@class,' topic/xref ')]
                      [contains(@outputclass, 'qrcode')]">
<fo:external-graphic>
<xsl:attribute name="src"><xsl:value-of select="concat('https://chart.
googleapis.com/chart?cht=qr&amp;chs=100x100&amp;chl=', .)"/>
</xsl:attribute>
</fo:external-graphic>
</xsl:template>
 see: http://ditanauts.org/2012/03/14/qr-codes-in-dita-ouput/

Sample (code: <img src="http://chart.apis.google.com/chart?chs=200x100&cht=qr&chl=http%3A%2F%2Ftrent-intovalue.blogspot.de%2F2006%2F05%2Ftrent-definition.html" width="200" height="100" alt="" />):

QR Code Sample


No comments: