I spent a couple of days investigating what this device can do:
3M Full Page ScannerThis smart device is supposed to be able to scan all sorts of passports and other identification documents and retrieve values like names, date of birth, document expiry dates and such. The documentation is not very straightforward and the code samples are in C++ only so it took me a bit of time to figure out how to operate this device programmatically.
First of all, a DocAuth.dll has to be referenced. (There is a bunch of development resources on the CD that comes with the device, and the dll’s are there too). After that, an object of a ReaderClass can be created.
using DOCAUTHLib;
...
r = new ReaderClass();
then the connection to the device has to be established
r.Connect("D72086", "Scanner", "ProcessingDone");
"ProcessingDone" is the comma-separated string that specifies which events will be captured. Other events are “NewDocument ”, “DocumentIdentified ”, etc. After the connection is established, you can subscribe to the scanner events.
r._IReaderEvents_Event_ReaderEvent += new _IReaderEvents_ReaderEventEventHandler(r__IReaderEvents_Event_ReaderEvent);
void r__IReaderEvents_Event_ReaderEvent(string @event){}
In this case, for example, if subscription is made to “ProcessingDone” event only, then whenever a new document is placed into the scanner, it will be automatically scaneed and after that the event will be fired and captured by the function. This might not always be very handy, so I chose to run scans manually. This is done by simply calling
r.DoScan();
To use the device as a simple image scanner, you can instruct it to process the image as a generic image.
r.ForceDocumentProcessing("Generic Image Capture", "");
The image, for some reason, is returned as a string.
string s = r.RetrieveImageItem("Visible", “BMP”); // or JPG, etc.
Alternatively, the image can be saved to disk straight away.
r.RetrieveImageItemAndSave("Visible", “JPG”, @"C:\scan.jpg");
Now, when you want to use this device for automatic retrieval of data from various documents, things become more interesting. Apparently, the list of documents that can be recognised, is stored on the device somewhere. Here is how this can be accessed:
r.RetrieveDatabaseList("");
string dv = string.Empty;
for (int i = 0; i < r.DatabaseListCount; i++)
{
dv = r.get_DatabaseListValue(i);
}
The “database list” is the list of types of documents that are available for recognition. It contains values like “2Line44” or “3Line30”. After the type has been selected, you can access the list of more particular documents belonging to this type in a similar way:
r.RetrieveDocumentItemList(“2Line44”);
string lv = string.Empty;
for (int i = 0; i < r.DocumentItemListCount; i++)
{
lv = r.get_DocumentItemListValue(i);
}
The ‘document item list’ contains values like “Hungarian_Passport”, “Netherlands_Old_Passport” etc. – a lot of them.
Now, after a particular document that we are going to try to read is chosen, we can go and access all the information that the scanner is trying to extract from it.
r.Connect("D72086", "Scanner", "ProcessingDone");
r.ForceDocumentProcessing("2Line44", "Australia_Passport");
r.DoScan();
string fName = r.RetrieveTextItem("@mrz_surname");
string lName = r.RetrieveTextItem("@mrz_givname");
If we’re lucky, the strings will contain proper name of the passport owner.
Now I can go and write a small application that can be used, for example, to add clients to a company database. It will scan the client’s passport and automatically populate fields like name, sex, DOB and a few others.
Overall, it's a fun device to work with. :-)
by
Evgeny. Also posted on
my website