We got the requirement to scan and upload the image to the web application.
We have analyzed all the commercial twain solutions like DynamicWebTwain, csxImage,TwainControlX,TwainConnect, jTwain, JSane and others. Many
of the commercial solutions are very costly. Finally, we picked up the DynamicWebTwain for the following reasons:
1) DynamSoft is a Microsoft Gold Certified Partner
2) Stable software
3) The customers of DynamicWebTwain include IBM, HP and LockHeed Martin
4) Compatible with IE, FireFox and Mozilla
5) Good Technical Support
6) Cheaper one
7) Supports basic image editing features including Rotate, Crop, Miror, Flip and Change Image size
We used Ruby on Rails for our web application. Since the DynamicWebTwain is the ActiveX objects, we simply embeded the ActiveX object using html object tag in the rhtml page. We called the object methods through javascript and uploaded the image to the URL. Here is the javascript code used by us to upload the image.
var CurrentPath = CurrentPathName.substring(0, CurrentPathName.lastIndexOf("/") + 1);
strActionPage = CurrentPath + "court_images/save_scanned_image?court_id="+court_id;
frmScan.DynamicWebTwain1.HTTPPort = 3000;
frmScan.DynamicWebTwain1.HTTPUploadThroughPost("aspire76", 0, strActionPage, "imageData.pdf");
To the ROR developers, we used attachment_fu plugin to save the image in the file system. Here is the code for save_scanned_image action (See the above URL)
params.sanitize_keys!
court_image = CourtImage.new(:uploaded_data => params[:RemoteFile],:court_id => params[:court_id] )
respond_to do format
if court_image.save
format.html{render :text=>"#{court_image.id}"}
court_image is the active_recod which has_one attachment
has_attachment :storage => :file_system,
:size => 0.kilobytes..1.megabytes,
:resize_to => '320x200>',
:thumbnails => { :thumb => '100x100>' }
Plz note the below code where we are rendering back the court image id through response.
We can receive the response in javascript where we called the URL to upload the image (see above). Here is the javascript code to get the response:
var court_image_id = frmScan.DynamicWebTwain1.HTTPPostResponseString;
Hope, this will help the ROR and other web application developers to integrate the scanner device to the web application. The scanner device should be connected to the client (browser) system.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment