From TWAIN Device to Web Application

ScreenshotAt my place of employment we recently purchased a piece of software to design and print identification cards.  We were planning to use the software to make employee badges.  I did not have an opportunity to try out the software in advance because no trial version was offered.  However, the vendor made a good sales pitch, so I shelled out roughly a thousand dollars to purchase the software.

It turned out to be one of the most difficult-to-learn software packages I have ever attempted to use.  After laboring for  five hours, I still had not figured out how to print a single ID card.  I’m not the sharpest knife in the drawer, but I’m not the dullest, either.  There had to be a better solution.  Not wanting to spend more money, I decided to build the software myself.

As a web developer, my platform of choice is the LAPP stack (Linux, Apache, PostgreSQL, and PHP).  However, designing a web-based ID card printing application presented a problem.  How would I get an employee photograph from our TWAIN-compliant webcam on to my web server?  Of course, I could have the user capture the image and upload it, but that would create far to much hassle.  I needed a way to capture the image directly from the web browser.

After some Google queries, I found several companies offering solutions to my dilemma.  However, in trying them out I ran into several issues.  First, many solutions were targeted at Microsoft developers.  Because of that, they either could not be made to work with PHP, or had no examples or explanations on how to do so.  Other solutions did work with my platform but gave me little flexibility on how the capture took place or how it integrated into my interface.  The result was something that was either ugly, difficult to use, or both.  Since these were just the problems I had set out to avoid in the first place, there had to be something better.

And there was: Dynamic Web TWAIN from Dynamsoft turned out the be the one package that did the job.  Not only did it work with PHP, but had code samples and documentation on how to put it all together.  They offered both an ActiveX and a plug-in version.  The former works in Internet Explorer and the latter takes care of Firefox, Chrome, and Opera.  Although I’m not a Microsoft fan by any means, IE is widely used so I opted to develop using the ActiveX version to start with.   Within a few minutes I was able to get the trial version of Dynamic Web TWAIN in place allowing me to capture and upload images.  A few hours more and my application was up and running, allowing us to print ID cards.  There is still much work to be done with my software before it is ready to offer to the public, but my efforts so far have created something that is drop-dead simple to use and fills our needs at the office.  The screenshot at the top of this post shows how seamlessly the control integrates with the web page.  This screen shot was taken while using a low-quality camera – the fuzzy image is not a result of using the twain control.