Develop
Develop
Develop
1 Developer's Guide | 1
Table Of Contents
1. 2. 3. 4. 5. 6. Introduction Overview Getting Started Deployment License Agreement History 6.1. What's new in DotTwain 2.1 6.2. What's New in DotTwain 2.0 7. How To's 7.1. Acquire a Select Region of the Device 7.2. Acquire Directly to a File 7.3. Detecting a Camera Device 7.4. Embed in Internet Explorer 7.5. Upload an Image to a Server 3 4 5-7 8 9-12 13 13 13-14 15 15-16 16-18 18 18-19 19-21
Introduction
Atalasoft DotTwain 2.1 is a 100% Managed .NET Windows Form component with fast capturing of digital images from scanners, cameras, and other devices supporting TWAIN. It utilizes the improvements of the TWAIN 1.9 specifications for ultra fast scanning. It works with a .NET Bitmap object and has no dependencies other then the .NET Framework. This is intended for a small footprint "no-touch" deployment over the web or if you need scanning abilities without Atalasoft dotImage.
Full context sensitive help and documentation. Object-oriented design; a TWAIN extension to the .NET Framework. Create a custom interface to scan images, or use the default TWAIN interface. Automatic Document Feeder support, with full control of the feeder operations. Support for duplex scanning. File system support for navigating the internal device memory. Acquire images directly to file utilizing compression algorithms supported by the device. Select a region of the scanning bed to be acquired with frame support . Upload a scanned image to a server with the built in HTTP Post class. Supports Web Deployment ; Embed into an Internet Explorer Browser or deploy as a WinForms application Simplified automatic capture allowing the device to quickly capture multiple images for later acquisition. Imprinter/Endorser methods allowing a text string ito be stamped onto the acquired image during the acquisition. Barcode/Patchcode classes to access barcode and patchcode recognition abilities of the device. A low-level class allowing even more control over the scanning session for advanced users. Extensible to allow custom driver capabilities access. Image dataset support enables acquisition of specific images from a camera in a single operation. Quickly find out what capabilities, compression modes, frame sizes, resolutions and more, are supported by a device. Over 80 properties and 50 methods to give total control over the image acquisition.
l l
l l l l l
DotTwain has been tested on many industry leading document scanners including those from Kodak, Fujitsu, Panasonic, Canon, Visioneer, Xerox, and Bell & Howell.
Overview
This topic introduces you to the basic classes to give you a general understanding of Atalasoft DotTwain and how to begin using it.
Getting Started
This topic explains how to get started using Atalasoft DotTwain in your applications.
Acquisition is now included in your toolbox and you can double-click the control to add it to your form.
There is also a Parent property which is used by TWAIN when displaying dialogs and acquiring images. You must set the Parent property to the parent form or control in order to acquire images.
Deployment
4.1 Windows Based Deployment
To distribute Atalasoft Twain for .NET with your .NET application you simple need to include Atalasoft.DotTwain.dll and Atalasoft.Shared.dll in the same folder as the assembly that references it. Make sure that the version you distribute is the version your assembly was compiled with.
License Agreement
ATALASOFT SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT IMPORTANT READ CAREFULLY: This License Agreement (the Agreement) is a legal contract between you (either an individual or single business entity)(LICENSEE) and Atalasoft, Inc., (Atalasoft or LICENSOR) for the software product identified above, which includes computer software and, as applicable, associated media, printed materials, and online or electronic documentation (collectively the Software). BY CLICKING THE AGREE OPTION BELOW, OR BY INSTALLING, COPYING OR OTHERWISE USING THE SOFTWARE, YOU AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT, INCLUDING THE WARRANTY DISCLAIMERS, LIMITATIONS OF LIABILITY AND TERMINATION PROVISIONS BELOW. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, DO NOT INSTALL THE SOFTWARE, AND EXIT NOW. You are entitled to receive a full refund of any payment made for the Software by so requesting and returning any media and materials in unopened, unused condition and discarding any electronic serial numbers or registration information within 30 days after date of payment. 1. LICENSE GRANT AND LICENSE TERMS. This Agreement permits the LICENSEE the non-exclusive right to use one copy of a properly registered Atalasoft Software Development Kit (SDK), for development purposes on any two computers, provided the Software is in use on only one computer at any time, and is being used by the registered user. The Software is "in-use" on a computer when it is loaded into temporary memory (i.e. RAM) or installed into the permanent memory (i.e. hard disk, CD-ROM, or other storage device) of that computer. Its use in any other fashion is a default hereunder and Licensee shall be liable for all of Atalasoft's damages, including costs of collection and reasonable attorney's fees. It does not cover the use of the software under any other deployment condition, including without limitation: Kiosks, Quality Assurance/Testing Server License, COM Callable Wrapper Licenses for which a separate license agreement must be executed for an additional fee. In accordance with the deployment conditions contained in clause B of this Agreement, please contact our sales department for pricing. The Software accompanying this Agreement, regardless of the media on which it is distributed, is licensed to LICENSEE by Atalasoft. LICENSEE owns the medium on which the Software is recorded, but Atalasoft or its licensors retain title to the Software and related documentation. The license granted under this Agreement is subject to the terms and conditions contained herein. A. SDK License Conditions i. One License Per Developer. Developer is defined as an individual engaged in the development of a software application (the Application). Use of the Software requires one license per developer. Licenses are non-transferable between developers. For example, if a company has two developers that will use the Software, said company requires two licenses. This is the case even if the developers will not be working with the Software at the same time. This is also the case if a project involving the use of the Software is transferred from the original developer to a new developer and if the original developer returns within a one-year period. For easier access to the SDK and as a courtesy, the license allows a developer to install the SDK on up to two computers where the registered developer is the primary user (for example, a desktop workstation and a laptop). ii. No Application Programming Interfaces. This Agreement does not allow for exposing of the application programming interface (API) functionality to non-licensed users. LICENSEE may not create a dynamic link library (DLL) that exposes or wraps
Atalasoft DotTwain 2.1 Developer's Guide | 10 functionality of the SDK to a non-licensed developer. Violation of this stipulation is subject to the interpretation of Atalasoft and no other party. Atalasoft reserves the right to seek punitive damages including, but not limited to, lost income from sales. Contact the Sales Department for information on an OEM license allowing the API to be exposed to other developers. B. Deployment Conditions i. One Server License Required Per Application Server. "Application Server" is defined as a non-user computer, with up to two physical CPUs, configured with the intention of multiple people accessing it for any kind of service that has Atalasoft Software loaded into the servers RAM. Use of this Software requires one license per server. An additional server requires an additional license. Servers with more than two physical CPUs need a server license per each additional pair (or less) of CPUs. ii. Custom License Agreement Required for Client Applet Server . Client Applet Server is defined as a non-user computer that is used to directly deploy Atalasoft Software to the client to use the Software directly from a Web Browser. This includes ActiveX components that are deployed via CAB files, and DLLs that are distributed via Microsoft .NET Web Deploy only when functionality is integrated within a browser. Please contact the Sales Department at Atalasoft to discuss the specifics of the deployment. Web Deploying an executable (EXE) that uses Atalasoft Software which is not embedded in a browser does not require a Server license. iii. Custom License Agreement Required for Kiosk. Kiosk is defined as a single computer or workstation where a deployed application containing Atalasoft code is installed. The application or the computer itself is configured for multiple users to access and use the application. Kiosk pricing is based upon volume of deployments as well as technology to be implemented in the application. Contact the Atalasoft Sales Department to determine pricing. iv. Quality Assurance(QA)/Testing Server Licenses. QA and Testing Server licenses are available on a case by case basis. Licensees may request a QA or Testing Server license from the Sales Department only after production server licenses have been purchased. QA and Testing Server licenses are never to be used in production. If a QA or Testing Server license has been issued to a licensee, responsibility for any and all upgrades and maintenance for the server license falls upon the licensee. v. COM Callable Wrapper. Atalasoft .NET imaging toolkits are designed to be used from other .NET applications. In the understanding that some licensees need to take advantage of the components using unmanaged code the licensor can accommodate by providing a custom assembly-tied license. This custom license will allow a licensee to call Atalasoft .NET assemblies from non .NET applications by developing a COM Callable Wrapper. This license requires custom development and a license amendment. Contact the Sales Department to determine pricing. vi. Royalty Free Runtime Desktop Distribution. "Desktop" is defined as an "end-user" personal computer (PC) that may have Applications installed that directly, or indirectly, utilize the Software. A single SDK provides for unlimited distribution of Applications utilizing the Software onto Desktop environments. This does not apply for DotImage OCR Expervision Engine, DotImage Advanced Document Cleanup(ADC), DotImage Advanced Photo Effects(APE), DotImage GlyphReader OCR Engine, or DotImage OCR PDF Translator Add-On. 2. GOVERNING LAW. If LICENSEE acquired this Software in the United States then the laws of the Commonwealth of Massachusetts shall govern this Agreement. If this Software was acquired outside the United States then local laws shall apply. THE LICENSEE HEREBY IRREVOCABLY AND UNCONDITIONALLY (A) SUBMITS TO PERSONAL JURISDICTION IN THE COMMONWEALTH OF MASSACHUSETTS OVER ANY SUIT, ACTION OR PROCEEDING ARISING OUT OF OR RELATING TO THIS AGREEMENT AND (B) WAIVES ANY AND ALL PERSONAL RIGHTS UNDER THE LAWS OF ANY STATE (I) TO THE RIGHT, IF ANY, TO TRIAL BY JURY, (II) TO OBJECT TO JURISDICTION WITHIN THE COMMONWEALTH OF MASSACHUSETTS OR VENUE IN ANY
Atalasoft DotTwain 2.1 Developer's Guide | 11 PARTICULAR FORUM WITHIN THE COMMONWEALTH OF MASSACHUSETTS, AND (III) TO THE RIGHT, IF ANY, TO CLAIM OR RECOVER ANY SPECIAL, EXEMPLARY, PUNITIVE OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES OTHER THAN ACTUAL DAMAGES. THE LICENSEE AGREES THAT, IN ADDITION TO ANY METHODS OF SERVICE OF PROCESS PROVIDED FOR UNDER APPLICABLE LAW, ALL SERVICE OF PROCESS IN ANY SUCH SUIT, ACTION OR PROCEEDING MAY BE MADE BY CERTIFIED OR REGISTERED MAIL, RETURN RECEIPT REQUESTED DIRECTED TO THE LICENSEE AT THE ADDRESS SET FORTH ON PAGE ONE HEREOF, AND SERVICE SO MADE SHALL BE COMPLETE FIVE (5) DAYS AFTER THE SAME SHALL BE SO MAILED. NOTHING CONTAINED HEREIN, HOWEVER, SHALL PREVENT ATALASOFT FROM BRINGING ANY SUIT, ACTION OR PROCEEDING OR EXERCISING ANY RIGHTS AGAINST THE LICENSEE AND AGAINST ANY PROPERTY OF THE LICENSEE, IN ANY OTHER STATE. INITIATING SUCH SUIT, ACTION OR PROCEEDING OR TAKING SUCH ACTION IN ANY STATE SHALL IN NO EVENT CONSTITUTE A WAIVER OF THE AGREEMENT CONTAINED HEREIN THAT THE LAWS OF THE COMMONWEALTH OF MASSACHUSETTS SHALL GOVERN THE RIGHTS AND OBLIGATIONS OF THE LICENSEE AND ATALASOFT HEREUNDER OR THE SUBMISSION HEREIN BY THE LICENSEE TO PERSONAL JURISDICTION WITHIN THE COMMONWEALTH OF MASSACHUSETTS. 3. PROPRIETARY RIGHTS. i. Copyright. All title and copyrights in and to the Software (including, without limitation, any images, photographs, animations, video, audio, music, text, and applets incorporated into the Software), the accompanying media and printed materials, and any copes of the Software are owned by Vendor or its suppliers. Copyrights laws and international treaty provisions protect the Software. Therefore, LICENSEE must treat the Software like any other copyrighted material, subject to the provisions of this Agreement. ii. U.S. Government Restricted Rights. The Software and documentation are provided to the U.S. Government with RESTRICTED RIGHTS. Use, duplication, or disclosure by the Government is subject to restriction as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights at 48 C.F.R. 52.227-19, as applicable. Manufacturer for such purpose is Atalasoft, Inc. iii. Submissions. Should LICENSEE decide to transmit to Atalasofts Web site by any means or any materials or other information (including, without limitation, ideas concepts or techniques for new or improved services and products), whether as information, feedback, data, questions, comments, suggestions or the like, LICENSEE agrees such submissions are unrestricted and shall be deemed nonconfidential and LICENSEE automatically grants Atalasoft and its assigns a nonexclusive, royalty-free, worldwide, perpetual irrevocable license, with the right to sublicense, to use, copy, transmit, distribute, create derivative works of, display and perform the same. iv. Reverse Engineering, Decompilation and Disassembly. LICENSEE may not reverse engineer, decompile, or disassemble the Software, except and only to the extent that it is expressly permitted by applicable law notwithstanding this limitation. 4. DISCLAIMER OF WARRANTY. THIS SOFTWARE AND ACCOMPANYING FILES ARE PROVIDED AS IS. ATALASOFT AND ITS SUPPLIERS DO NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE OR SUCH FILES. ATALASOFT AND ITS SUPPLIERS MAKE NO WARRANTIES, EXPRESS OR IMPLIED, AS TO TITLE OR INFRINGEMENT OF THIRD-PARTY RIGHTS, MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. THE USER MUST ASSUME THE ENTIRE RISK OF USING THE SOFTWARE. ANY LIABILITY OF ATALASOFT FOR A DEFECTIVE COPY OF THE SOFTWARE WILL BE LIMITED EXCLUSIVELY TO REPLACEMENT OF YOUR COPY OF THE SOFTWARE WITH ANOTHER COPY OF REFUND OF THE INITIAL LICENSE FEE ATALASOFT RECEIVED FROM YOU FOR THE DEFECTIVE COPY OF THE SOFTWARE. IN NO EVENT WILL ATALASOFT OR ITS
Atalasoft DotTwain 2.1 Developer's Guide | 12 SUPPLIERS BE LIABLE TO YOU FOR ANY CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS OR LOST SAVINGS, EVEN IF AN ATALASOFT REPRESENTATIVE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 5. MARKETING. LICENSEE agrees to be identified as a customer of Atalasoft and LICENSEE agrees that Atalasoft may refer to LICENSEE by name, trade name and trademark, if applicable, and may briefly describe LICENSEES business in Atalasoft's marketing materials and Web site. LICENSEE hereby grants Atalasoft a license to use LICENSEES name and any of LICENSEES trade names and trademarks solely in connection with the rights granted to Atalasoft pursuant to this marketing section. However, Licensee agrees not to use the Atalasoft's name, logo, or trademarks to market the Application without prior written approval of Atalasoft. 6. UPGRADES. To use a product identified as an upgrade, LICENSEE must first be licensed for the Software identified by Atalasoft as eligible for the upgrade. After upgrading, LICENSEE may no longer use the Software that formed the basis for LICENSEES upgrade eligibility. 7. ADDITIONAL SOFTWARE. This Agreement applies to updates or supplements to the original Software provided by Atalasoft, unless we provide other terms along with the update or supplement. 8. TERMINATION. Without prejudice to any other rights, Atalasoft may cancel this Agreement if LICENSEE does not abide by the terms and conditions of this Agreement, in which case LICENSEE must destroy all copies of the Software and all of its component parts. 9. CONSENT TO USE OF DATA. LICENSEE agrees that Atalasoft and its affiliates may collect and use technical information LICENSEE provides as a part of the support services related to the Software. Atalasoft agrees not to use this information in a form that personally identifies LICENSEE. 10. SEVERABILITY. If for any reason a court of competent jurisdiction finds any provision of this Agreement or portion thereof to be unenforceable that provision of the Agreement shall be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remainder of this Agreement shall continue in full force and effect. 11. NON-WAIVER. The failure of either party to enforce any rights granted hereunder or to take action against the other party in the event of any breach hereunder shall not be deemed a waiver by that party as to subsequent enforcement of rights or subsequent actions in the event of future breaches. 12. INDEMNIFICATION BY LICENSEE. If LICENSEE distributes the Software in violation of this Agreement, LICENSEE agrees to indemnify, hold harmless and defend Atalasoft and its suppliers from and against any claims or lawsuits, including attorneys fees that arise or result from the use or distribution of the Software in violation of the Agreement. 13. ENTIRE AGREEMENT. This Agreement, including any addendum or amendment to this Agreement which is included with the Software, is the entire agreement between LICENSEE and Atalasoft relating to the Software and the Support Services (if any) and they supersede all prior or contemporaneous oral or written communications, proposals and representations with respect to the Software or any other subject matter covered by this Agreement. To the extent the terms of any Atalasoft policies or programs for Support Services conflict with the terms of this Agreement, the terms of this Agreement shall control.
6 6.1
An AutoDiscardBlankPages property was added. For drivers that support this feature it will automatically skip scanned pages it believes to be blank. Added LoadXmlParameters and SaveXmlParameters methods. Theses methods can be used to save and restore device settings without the driver needing to support any special capability.
6.1.2 Changes
l
DotTwain now requires distribution of Atalasoft.Shared.dll. Any project that uses DotTwain should also reference this new assembly.
6.2
A low-level class named TwainController has been added to provide more control over the TWAIN session, allowing the developer to obtain more information directly from TWAIN while maintaining an easy to use interface. The TwainController can be used as a standalone object or accessed from the Device.Controller property to allow a mix of upper and lower-level coding. Added over 20 methods to the Device object that provide information on the values supported for specific capabilities. Added Barcode and Patchcode properties to the Device object that allow access to barcode and patchcode detection features supported by the device. Added support for buffered memory transfer. Added SaveParameters and LoadParameters methods that can be used to store device settings between sessions. The device must support the TwainTriplet.CustomDSDataSet capability to use these methods. Added Enable and Disable methods to the Device object that are used to keep the scanner interface displayed between scans. Added a BeforeTwainDataTransfer event that will provide general information on the image about to be scanned. This will allow you to cancel the scan if the image parameters do not meet your requirements. Added the ability to handle processing of the acquired data. This is convenient if the data is a format not supported directly in DotTwain. Added the ability to access custom driver properties that are not part of the TWAIN specification by using the TwainController and ITwainDataStructure interface for defining these capabilities. Added a CanOpen method which can be used to determine if a call to the Open method will succeed. Added a LastReturnCode property and GetConditionCode method which is used to provide more detailed information should setting a Device property fail to change its value. Added an ImageLayout property as an alternative to the Frame property for devices that do not support the DeviceCapability.ICAP_FRAMES. Added the ability to specify multiple frames when acquiring, provided the device has this capability.
l l
l l
6.2.2 Changes
l
Properties in the Acquisition object, such as Manufacturer, Country and Language, have been combined
The DeviceCapabilities enumeration has changed to match the names in the TWAIN specification. Device. GetSupportedCapabilities now returns an array of DeviceCapability instead of string. Renamed ImprinterEndorserTypes to ImprinterEndorserType and the None enumeration value has been removed. Device. GetSupportedPrinters now returns an array of ImprinterEndorserType. Renamed TwainDataImageInfoArgs to TwainDataImageInfoEventArgs. TwainResolution now uses float (Single) values instead of double. The following property types have been changed:
l l l l
Device.Brightness changed from Int32 to Single. Device.Contrast changed from Int32 to Single. Device.Gamma changed from Double to Single. Device.MinimumHeight changed from Double to Single. Device.MinimumWidth changed from Double to Single. Device.PhysicalHeight changed from Double to Single. Device.PhysicalWidth changed from Double to Single. Device.Rotation changed from Double to Single. Device.Shadow changed from Int32 to Single. Device.Threshold changed from Int32 to Single.
AcquireModal has been deprecated. Instead, set the Device.ModalAcquire property to True and use the Acquire method. This means you must handle the ImageAcquired event to get the image. The Acquire overload taking two Boolean parameters ( hideInterface and saveToFile ) has been deprecated. Instead, set the Device.HideInterface and Device.TransferMethod properties to control these parameters. Acquisition.ShowSelectSource will now return null (Nothing) if the dialog is canceled.
7 7.1
7.2
7.3
7.4
<object id="Twain" classid="http://siteaddress/MyControl.dll#MyScanObject" width="100" height="100"></ob As you can see, the only real difference is the classid parameter. The first part of that parameter tells the browser where the assembly is located. If you don't use a path, the assembly is assumed to be in the same folder as the web page. This is followed by a hash ( #) symbol and the name of the class object you want to
7.5