[reportlab-users] How to create special micr control character in Reportlab

Tim Roberts timr at probo.com
Fri May 10 15:02:46 EDT 2013


Mike Driscoll wrote:

>

> I am trying to create a MICR line for a check in Reportlab. I am able

> to register my MICR font (MICRCheckPrixa) with Reportlab, but can't

> quite get it to show the MICR control characters. I am porting

> existing code from XSL to Python.

>

> The XSL line in question looks like this:

>

> &#160;&#59;<xsl:value-of

> select="substring(concat('000',$accountchecknumber),

> string-length($accountchecknumber))"/>&#59;&#160;&#58;<xsl:value-of

> select="$micr2"/>&#58;&#160;<xsl:value-of select="$micr1"/>&#59;

>

> I translated to the following Python code:

>

> micr = '<font name="MICRCheckPrixa"

> size=14>&#160;&#59;%s&#59;&#160;&#58;%s&#58;&#160;%s&#59;</font>'


You shouldn't need that much magic. The |: symbol in that font is the
glyph for a perfectly normal colon. The ||O symbol is a glyph for the
normal semi-colon. So, to duplicate the exact account number in that
Wikipedia sample, you should just be able to use this:
:011234567: 001234567; 243

The &#160 in there is the Unicode non-breaking space. That's only
needed for XML. You should just be able to use normal spaces.

--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list