Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, August 11, 2010 1:35:04 AM(UTC)
justus_vin

Groups: Registered
Posts: 2


Can you provide the scan code using silverlight...

Also provide the info which dlls to be used...
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, September 9, 2010 7:13:32 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 215

Was thanked: 3 time(s) in 3 post(s)

With the release of Silverlight 4 came the support to communicate with COM objects when a Silverlight application is run out of browser with elevated trust.  This allows you to communicate with any COM object installed on the users/client's machine. 

In order to scan from a scanner on the client's machine, you must be able to communicate with the scanner's driver, which is also found on the client's machine. 

As of this article's submission date, there is no COM object that allows you to communicate with Twain that is already installed with Windows or that is available through a Windows Update.

Therefore, it is up to you, the developer, to create such a COM object and deploy it to the client's machine through whatever means available (Cabinet File,  MSI installer, etc...)

The attached solution shows you how to create this COM object using LEADTOOLS's .NET classes. 

The TwainCOMWrapper project wraps our TwainSession .NET class in a UserControl and gives it a GUID and ProgID.  The project settings are adjusted also.  Under Application | Assembly Information dialog, ensure "Make assembly COM-Visible" is checked.  Under Build make sure "Register for COM interop" is checked to register the class on your development machine. 

The OutOfBrowserApplication is a Silverlight 4 Application setup to run out of brower with elevated trust.  In the project settings, under Silverlight, ensure "Enable running application out of the browser" is checked.  Also, click on the "Out of Browser Setting" button.  In the next dialog, ensure "Require elevated trust when running outside the browser" is checked. This will allow the Silverlight application to create COM objects on the user's machine. 

In the Silverlight code you will create an instance of the COM object using the AutomationFactory.CreateObject function.  You assign the returned value to a dynamic variable.  Please note the "dynamic" keyword is available by adding a reference to the "Microsoft.CSharp.dll" to your references.  You can then use your COM object like any other COM object in .NET. 

The COM object also contains an AcquirePage event.  The Silverlight project shows you also how to handle this event using a delegate and dynamic objects. 

The code for creating the COM object can be found in the App.xaml.cs file under the Application_Startup event.  The application ensures Twain is available, and if so, creates the object and passes it to the MainPage.  The MainPage then uses the object.  When the application is closed we handle the Application_Exit to close the Twain session. 

Please note this is not a finished application but merely a sample to help you get started with adding Twain support to your Silverlight application. 

For information about accessing COM through Silverlight 4, and to see a video demonstrating how to setup your Silverlight project to access COM., please take a look at the MSDN video found here:  http://www.silverlight.net/learn/videos/all/com-object-access-trusted-applications/

With the release of Silverlight 5, you can now have In Browser Applications access the file system which will allow you to access COM objects from within the browser.  See the following Microsoft article to learn how this can be done:
http://msdn.microsoft.com/en-us/library/ee721083(v=vs.95).aspx


File Attachment(s):
ScanWithSilverlight.zip (20kb) downloaded 32 time(s).
Travis Montgomery
Senior Sales Engineer
LEAD Logo
 
#3 Posted : Sunday, October 17, 2010 11:16:27 PM(UTC)
smurrell

Groups: Registered
Posts: 5


Hello

I have registered the TwainCOMWrapper.dll using RegAsm on .NET Framework v4.0.
However when I try run the application it moans that it cannot find the ProgID.
Is there anything which you can think which I am doing wrong?

Regards,
Simon
 
#4 Posted : Tuesday, October 19, 2010 6:39:20 AM(UTC)

Adam Boulad  
Guest

Groups: Guests
Posts: 3,049

Was thanked: 1 time(s) in 1 post(s)

Simon,
You are using LEADTOOLS version 17. Is this correct? Can you answer the following questions:
1) What is the Operating System (XP, Vista, 7, etc.) of the deployment machine and is it 32-bit or 64-bit version?
2) Are both the server and client on the same machine or are you accessing the server from another machine?
 
#5 Posted : Saturday, November 20, 2010 10:53:42 AM(UTC)
smurrell

Groups: Registered
Posts: 5


I am running v17. I am running Windows 7 64 bit. I am accessing the app from the same machine.
 
#6 Posted : Monday, November 22, 2010 7:40:53 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 215

Was thanked: 3 time(s) in 3 post(s)

Ensure your project's settings are set to x86 in the TwainCOM project.  The referenced DLLs are built for x86 system.  They will still work on an x64, as long as the project's configuration is set to x86.
Travis Montgomery
Senior Sales Engineer
LEAD Logo
 
#7 Posted : Wednesday, December 1, 2010 11:05:44 PM(UTC)
smurrell

Groups: Registered
Posts: 5


We did that. It isn't failing now with the ProgID. But nothing is being displayed on the Silverlight application. The form just has a blank white background.
 
#8 Posted : Thursday, December 2, 2010 5:48:27 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,331

Was thanked: 1 time(s) in 1 post(s)

I want to investigate this issue further, so please send an email to support@leadtools.com and mention this forum post in your email.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#9 Posted : Thursday, December 16, 2010 11:20:45 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 215

Was thanked: 3 time(s) in 3 post(s)

The project has been updated.  There were some Solution Configuration issues that have now been resolved.

The OutOfBrowserApplication's platform must be set to AnyCPU and the TwainCOMWrapper's platform must be set to x86. 

This configuration will work for both x86 and x64 systems. 

Also:
The OutOfBrowserApplication project must be referencing the DLLs found in the "\Program Files\LEAD Technologies\LEADTOOLS 17\Bin\Silverlight4" directory.
The TwainCOMWrapper project must be referencing the DLLs found in the "\Program Files\LEAD Technologies\LEADTOOLS 17\Bin\Dotnet4\Win32" directory.
Travis Montgomery
Senior Sales Engineer
LEAD Logo
 
#10 Posted : Wednesday, December 29, 2010 1:31:09 AM(UTC)
Sachin Tekchandani

Groups: Registered
Posts: 2


Hi Travis,
<br />
We are also facing the same issue. When we launch the test page for the silverlight app (by selecting Dynamically generate a test page option for Start Action under project -debug settings), we are getting "This operation is not supported in the current context." exception message.
<br /><br />
On debugging the issue we found that this exception is raised when we try to create object of Leadtools.TwainCOMWrapper COM component.
<br /><br />
Note that, the application runs fine when we launch it as out-of-browser application.
<br /><br />
Is there any constraint that this application can only be launched as out-of-browser app and not from within the browser?
<br /><br />
Can you please help me resolve this issue.
<br /><br />
Thanks,<br />
Sachin
 
#11 Posted : Wednesday, December 29, 2010 4:26:32 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,331

Was thanked: 1 time(s) in 1 post(s)

Sachin,

You already sent this issue to support@leadtools.com. We will continue discussing this issue through the support ticket.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#12 Posted : Tuesday, January 4, 2011 10:40:00 PM(UTC)
Sachin Tekchandani

Groups: Registered
Posts: 2


Hi,
Considering the Microsoft limitation to access COM object from browser, we went the OOB way and created a Silverlight app that will be installed on the client. This app when invoked in OOB mode will allow user to capture an image from Web Camera/External camera plugged into their system. This app is working fine on the development machine but when installing and running from "SOME" client machine it throws error which says -

[ComAutomation_CreateInstance]
Arguments:
Debugging resource string are unavailable.......

This looks like the app errors at creating COM object.

This app works fine on client machines, which have VS2010 installed currently or had VS2010 installed in the past and is now removed.
Can you tell what all components are required on the client to make this app work fine? My investigation says it requires a.) .Net Framework 4 Client Profile.
b.) .Net Framework 4 Extended.
c.) .Net Framework 4 Multi-targeting Pack.
However, if I install these component on the client (which never had VS2010 installed) even then my app does not work properly and throws the above error.

Attached is the zip file of the solution. This contains 3 projects-
a.) OutOfBrowserApplication – a silverlight app
b.) TwainCOMWrapper – a .Net wrapper to TWAIN COM component.
c.) Setup1 – a setup project that registers TwainCOMWrapper on the client.

Please look into the attached solution and let me know if I am missing on anything.

Thanks,
Sachin Tekchandani
File Attachment(s):
ScanWithSilverlight.rar (16kb) downloaded 31 time(s).
 
#13 Posted : Friday, January 7, 2011 4:45:22 AM(UTC)

Travis  
Travis

Groups: Registered, Tech Support
Posts: 215

Was thanked: 3 time(s) in 3 post(s)

Please ensure you also have all Microsoft dependencies listed in our "Files to be Included With Your Application" section in our help file.  Here is the online link: http://www.leadtools.com/help/leadtools/v175/dh/to/leadtools.topics~leadtools.topics.filestobeincludedwithyourapplication.html
Travis Montgomery
Senior Sales Engineer
LEAD Logo
 
#14 Posted : Thursday, February 2, 2012 5:43:23 AM(UTC)
Praneeth Purighalla

Groups: Registered
Posts: 2


Hi Sachin,

I am facing the exact same issue. Did you get it to work? If yes, could you tell me how?

Thanks,
Praneeth
_______________________________
Note by moderator:
Travis has updated the help topic link above to version 17.5, our current version, so it should work. Ensure you have all files that are listed in this link.

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.350 seconds.