Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OCR a PDF
Message
 
To
24/02/2012 14:16:00
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01536474
Message ID:
01536499
Views:
55
>Hi All:
>
>Here's an interesting one:
>
>My client prints out sales orders. The sales order number is barcoded. He uses a barcode reader to read each sales order and enter sales order into his system.
>
>He has a remote office that can send him scanned PDFs of the sales orders. The reason he needs the scanned copy is because he needs to see the changes that are written on the sales orders.
>
>Rather than printing the PDFs out, the user wants the VFP program to loop through the pdf files, invoke a program that OCRs the PDF and retrieves the SO# (from the barcode?) and enters the SO# into the screen, presents him with the sales order PDF so that he can see the changes he needs to make, mimicing the physical reading of the barcode from a printed piece of paper.
>
>Is this remotely possible??
>
>Thanks,
>
>Yossi

See if it works for you (requires MS Office 2003 or 2007 where MODI is included)
CLEAR
* set printer to MODI
oWSHNet = CREATEOBJECT('Wscript.Network')
oWSHNet.SetDefaultPrinter('Microsoft Office Document Image Writer')

* run report to file
lcoutfile="c:\hi.XXX"
ERASE (lcoutfile)
USE your_table
REPORT FORM report_name TO FILE (lcoutfile) noco

* close MODI interface if it arrived
WAIT WINDOW TIMEOUT 1.0 ""
oshell = CREATEOBJECT("wscript.shell")
IF oShell.AppActivate("hi.XXX")
	oShell.SendKeys("%Fx")
ENDIF
WAIT WINDOW TIMEOUT 1.0 ""

* do OCR, file should be in tif format, and with tif extention. At least, it is how it works for me
miFILE_FORMAT_TIFF=1
miDoc = Createobject('MODI.Document')
miDoc.Create( "C:\hi.XXX")
erase c:\hi.tif
miDoc.SaveAs("c:\hi.tif", miFILE_FORMAT_TIFF)
midoc.Close()

miDoc.Create( "C:\hi.tif")
miDoc.Images(0).OCR

?miDoc.Images(0).Layout.text            && get text

midoc.Close()

* do cleanup for objects created....
   ......
Good Luck
Previous
Reply
Map
View

Click here to load this message in the networking platform