in reply to OCR Code

Somehow i need to generate OCR code

So, after piecing together all of your posts in this thread, it seems you want to be able to create a PDF document that uses a font, such as OCR-A or OCR-B, that is designed for reading by OCR systems.

You don't explain how you generate your PDF now. If you are using PDF::API2, I think it allows you to use any TrueType Font you want. If you aren't using it, I suggest you review it. I've not used it much myself (I've played a bit), but I've heard good things from people who have. There are some examples available at http://www.penguin.at0.net/~fredo/files/ which you may find helpful.

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: OCR Code
by Anonymous Monk on Dec 11, 2003 at 20:23 UTC
    I am using same PDF::API2. I also look at http://www.penguin.at0.net/~fredo/files . i did not find any example on OCR font. or how to change font. Do u have any example. thanks Tejas

      Can you show us your code that uses PDF::API2?

      It should be a simple matter of changing or adding a font definition to your code.

      You should have a font definition in you want to look something like:

      my $doc = PDF::API2->new( -file => 'mypdf.pdf' ); my $page = $doc->page; my $txt = $page->text; my $font = $doc->corefont('OCR A',1); # this font name may be incorrec +t.. $font->encode('latin1'); $txt->font($font,10); $txt->lead(10); $txt->text('Print to PDF file in the font set above'); # ....

      cheers,

      J

        I run the following code for testing. Basically it's same piece of code using OCR_A font.

        It's giving me below error.

        use PDF::API2; my $doc = PDF::API2->new( -file => 'mypdf.pdf' ); my $page = $doc->page; my $txt = $page->text; my $font = $doc->corefont('OCR_A',1); # this font name may be incorrec +t.. $font->encode('latin1'); $txt->font($font,10); $txt->lead(10); $txt->text('Print to PDF file in the font set above');

        Error

        C:\www\cgi-bin>perl tej.pl requested font 'ocra' not installed at c:/perl/site/lib/PDF/API2/Core +Font.pm li ne 84.
        thanks Tejas

        Edited by BazB - added code tags.

A reply falls below the community's threshold of quality. You may see it by logging in.