[reportlab-users] Micr font advice in reportlab

49 views
Skip to first unread message

Mike Driscoll

unread,
May 29, 2013, 10:48:02 AM5/29/13
to reportl...@lists2.reportlab.com
Hi,

I posted about this issue a couple weeks ago and still haven't figured it out, but I found some more information about the font. I am using a font called MICRCheckPrixa. You can read about it here:

http://www.micre13b.com/MICRCheckPrixa.pdf

According to the spec, I should be able to use semi-colons to get one of the funky MICR characters, however it seems to be getting eaten by Reportlab somehow.

Here's my code snippet:

micr = '<font name="MICRCheckPrixa" style="regular" size=14>;%s; :%s: %s</font>'
micr_line = micr % (self.check_data.check_number,
                            self.check_data.bank_routing_number,
                            self.check_data.bank_account_number)

The colons turn into the correct character, but the semi-colons end up looking blank. I have attached a quick example code and its output. You can see the colons have been transformed per the spec, but the semi-colons are eaten. There's a demo version of the font that has both the characters (I think), so if anyone has any ideas or solutions, I'm all ears.

I am running Python 2.6 on Windows 7.

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

Blog:   http://blog.pythonlibrary.org
micr_test.py
test.pdf

Henning von Bargen

unread,
May 29, 2013, 11:11:13 AM5/29/13
to reportl...@lists2.reportlab.com
You are wrong, the semi-colon is there!

When I open your attached PDF file with Adobe Reader,
select the whole text and copy it into a text editor,
it is shown as
123456; :1234567890: 1111111111

Note the semi-colon after 123456.

HTH
Henning

_______________________________________________
reportlab-users mailing list
reportl...@lists2.reportlab.com
http://two.pairlist.net/mailman/listinfo/reportlab-users

J. R. Carroll

unread,
May 29, 2013, 12:44:01 PM5/29/13
to reportlab-users

Sending this backup to the listserv as a response - removing the image as it was 'too large'.  My apologies if this gets double-posted.

-j

On Wed, May 29, 2013 at 12:39 PM, J. R. Carroll <jrc....@gmail.com> wrote:
Mike,

Not sure, but if you are trying to get the 'funky P' shape you emailed about a few weeks back (as in the image I am attaching [EDIT] IMAGE REMOVED) - that's easy enough (but I'm assuming this is a different issue)... 

If you are trying to get a semi-colon, I don't believe E13-B as a standard has that (http://en.wikipedia.org/wiki/File:MICR.svg and its parent article http://en.wikipedia.org/wiki/Magnetic_ink_character_recognition).  On inspection of the "demo" fonts available via the links you provided (as I would love to help the Mr. Driscoll of http://www.blog.pythonlibrary.org/, I can't afford the $$ to buy the legit font, no offense =P), they say they only omit 7. 8. and 9 with no mention of omitting a semi-colon.  Furthermore, inspecting the character/glyph map of the demo fonts show that there is no mapping for semi-colon key-strokes to a comp micr/e13b glyph.  If you are truly trying to get a semi-colon, my guess is that you'll have to switch fonts mid-string (or make your own glyph for the semi-colon - aka copy one over).  

If, for whatever reason you were trying to get the 'funky P' you mentioned in previous listserv questions, that symbol is mapped to the double-quote key (as the image I attached shows [EDIT] IMAGE REMOVED) - if this is an old/retired issue, then ignore this. 

-J

J. R. Carroll

unread,
May 29, 2013, 1:02:23 PM5/29/13
to reportlab-users
I forgot to add that the ttf font does have the semi-colon mapped as the funky-p shape, but the afm/pfb fonts do not (they are using the double-quote instead).  Perhaps thats the confusion between the font-spec provides versus the fonts you are trying to embed.  

-j

Tim Roberts

unread,
May 29, 2013, 1:45:34 PM5/29/13
to reportlab-users
Mike Driscoll wrote:
>
> The colons turn into the correct character, but the semi-colons end up
> looking blank. I have attached a quick example code and its output.
> You can see the colons have been transformed per the spec, but the
> semi-colons are eaten. There's a demo version of the font that has
> both the characters (I think), so if anyone has any ideas or
> solutions, I'm all ears.

Believe it or not, the problem is in the font files. I had assumed you
were using the TrueType file, and the TrueType file is correct.
Instead, your code is using the Type 1 files (AFM/PFB). If you go look
at the human-readable version (of that the PFA), you'll see that the
Type 1 font simply does not include the semi-colon. (I checked the demo
version, but I assume the real version is the same.)

If you paid for this font (and I assume you did), that's a bug, and you
should complain. In the meantime, if you switch to the TrueType
version, this problem will go away.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Mike Driscoll

unread,
May 30, 2013, 12:27:29 PM5/30/13
to reportl...@lists2.reportlab.com
Hi Dinu,




Message: 2
Date: Wed, 29 May 2013 22:12:12 +0200
From: Dinu Gherman <ghe...@darwin.in-berlin.de>
Subject: Re: [reportlab-users] reportlab-users Digest, Vol 112, Issue
        14
To: reportlab-users <reportl...@lists2.reportlab.com>
Message-ID: <0936674A-5435-416F...@darwin.in-berlin.de>
Content-Type: text/plain; charset=us-ascii

Mike Driscoll:

> Actually, it is still the funky "P" thing I mentioned earlier, but I never received much of a response then. I got one digest that seemed to be commenting on someone's answer, but I couldn't find the actual answer. Fortunately, at the time, no one at my company cared about the "P", but it seems I need to re-implement this after all and now it's important again.

I'm not sure if you mean these two postings of mine or not:

http://two.pairlist.net/pipermail/reportlab-users/2013-May/010741.html
http://two.pairlist.net/pipermail/reportlab-users/2013-May/010742.html

In any case it looks like using customized fonts like these can easily
cause hard to find bugs. I'd still prefer using a subset of a widely
tested font like Code2000 (mentioned in the above postings) even if
that means using the proper Unicode codes.

BTW, this problem might become worse in the future with services I've
discovered recently like http://fontello.com and friends...

Regards,

Dinu

PS: Also, useful subject lines can be, well, pretty useful, at a later
    point of time. ;-)


Yes, that appears to be the ones that weren't delivered to my inbox for some reason. Also I apologize for the poor subject line. I need to change from digest to normal mode for receiving emails. Thanks for the hint!
Reply all
Reply to author
Forward
0 new messages