tmaly has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use Win32::OLE; use Win32::OLE::Const; use Win32::OLE::Enum; my $wd = Win32::OLE::Const->Load("Microsoft Office Document Imaging 11 +\.0 Type Library"); my $o = Win32::OLE->new('MODI.Document', sub {$_[0]->Quit;}) or die("Cannot create modi document\n"); if (!defined($o)) { die("no object!\n"); } $o->Create('test.tiff'); # ocr the text then save it back into the tiff # you only have to do the next two steps once and the # ocr text will be saved for later use if you wish to # open the tiff at a later time $o->OCR(); $o->Save(); my $im = $o->{Images}; my $en = Win32::OLE::Enum->new($im); my @ims = $en->All; # now print out the text from each page foreach my $i (@ims) { print $i->{Layout}{Text} . "\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32 and OCR via OLE
by marto (Cardinal) on Apr 10, 2008 at 11:03 UTC | |
|
Re: Win32 and OCR via OLE
by ww (Archbishop) on Apr 10, 2008 at 11:00 UTC | |
by tmaly (Monk) on Apr 10, 2008 at 13:32 UTC | |
by ww (Archbishop) on Apr 10, 2008 at 13:41 UTC | |
by marto (Cardinal) on Apr 10, 2008 at 13:47 UTC | |
by tmaly (Monk) on Apr 10, 2008 at 14:04 UTC | |
by ww (Archbishop) on Apr 10, 2008 at 14:39 UTC | |
by marto (Cardinal) on Apr 10, 2008 at 14:21 UTC | |
by BrowserUk (Patriarch) on Apr 11, 2008 at 00:11 UTC | |
|
Re: Win32 and OCR via OLE
by Corion (Patriarch) on Apr 10, 2008 at 10:57 UTC | |
|
Re: Win32 and OCR via OLE
by talexb (Chancellor) on Apr 10, 2008 at 14:04 UTC | |
|
Re: Win32 and OCR via OLE
by igelkott (Priest) on Apr 10, 2008 at 22:22 UTC |