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

Mike Driscoll mike at pythonlibrary.org
Fri May 10 14:16:36 EDT 2013


Hi,

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>'

And then I use some string substitution to put in the proper information.
For some reason, I only get control characters around the middle integer,
which looks kind of like this:

l:12345667l:

You can see the character I'm talking about here:
http://en.wikipedia.org/wiki/File:CanadianChequeSamplePAR.png (It's the
first one in the micr line on the check)

In the example I'm trying to duplicate, I need the funky sideways equals
sign+square (looks kind of like an odd p) to wrap around a couple of the
numbers. I found this wikipedia article, but I'm not sure how to implement
it in a way that Reportlab will work with:

http://en.wikipedia.org/wiki/Magnetic_ink_character_recognition

Does anyone else know how to do this? Any tips or hints would be most
appreciated! Thanks!


-----------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20130510/b43a50ac/attachment.htm>


More information about the reportlab-users mailing list