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"; }