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 : Tuesday, February 21, 2006 1:07:45 PM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


I would like to see a good twain example if one is available.  I have tried many different aspects of doing things and have gotten different results with each one.  If I use the fast twain modules, all of my settings seem to work and are applied to the scanner, but I get two scanned images versus one.  If I try to use the standard acquire modules, I cannot get all of my settings to update correctly to the twain session.  So I even tried making the scan interface available, then immediately after the scan completes, save the template.  Then upon trying to use the template, I get an error after loading the template and calling the acquire method without showing the user interface, stating that my images have been removed from the auto sheet feeder in the scanner...which I was not even using....and it aborts.  So is there an example out there which shows how to update multiple pieces of a twain session like DPI, transfer file information, and bits per pixel all in the same application?  I can find how to do these separately, but when I incorporate them all, like I stated, I get multiple images at the end versus one image.  Thanks.
 

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 : Wednesday, February 22, 2006 5:14:17 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

We have different samples that show how to use the different Twain settings.
The details depend on the programming interface (COM, API, DotNet, Etc.)?

However, if you are using COM programming interface, please refer to the following samples and tutorials in the "LEADTOOLS Twain COM Help":
- AcquireMulti Example for Visual Basic
- Acquiring an Image (Visual Basic)
- Using the Fast TWAIN Feature (Visual Basic)
- Get a Fast Twain Scan from a Scanner (Visual Basic)
- Twain Duplex (Visual Basic)

If you need a complete sample code that shows the different twain features, please refer to the LEADTOOLS Twain demos that come with the toolkit.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#3 Posted : Wednesday, February 22, 2006 7:26:36 AM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


Sorry. I should have been more descriptive.  We are using v14.5 and are building classes in C# which wrap the Leadtools objects.  I cannot find any .Net example (VB or C#) that sets the DPI, sets the bits per pixel, and sets the file transfer properties on one scan method.  I found places where they are described independently...and they seem to work independently, but when I put them together I get very strange behavior such as a scan occurring twice.  Could you provide some sample code which performs all three of these tasks?  The concept seems extremely simple, but yet, the Leadtools objects are not working as expected.  I would assume that means I am setting things out of order or something.  Here is a simple method I was trying to implement.  I could not get the capabilities to work so I tried the TwainImageResolution object instead.  Also, I would need instructions for control on how to handle images for multipage scans...I think all of that ties together with the fact that I get multiple pages when scanning one page with the multipage parameter set to false.

try

{

if(optionalTwainSourceName != "" && optionalTwainSourceName != null)

{

// Set twain device based on what was passed in.

_twSession.SetAcquireSourceName(optionalTwainSourceName);

}

else

{

// No option sent, default to first twain device.

_twSession.SetAcquireSourceName(_twSrcInfo[0].Name);

}

// _twSession.GetProperties();

// TwainCapability tcDPI = new TwainCapability();

// tcDPI.Information.ContainerType = TwainContainerType.OneValue;

// tcDPI.Information.Type = TwainCapabilityType.ImageXResolution;

// tcDPI.OneValue.ItemType = TwainItemType.Uint16;

// tcDPI.OneValue.Value = _dpi;

// _twSession.SetCapability(tcDPI,TwainSetCapabilityMode.Set);

// tcDPI.Information.ContainerType = TwainContainerType.OneValue;

// tcDPI.Information.Type = TwainCapabilityType.ImageYResolution;

// tcDPI.OneValue.ItemType = TwainItemType.Uint16;

// tcDPI.OneValue.Value = _dpi;

// _twSession.SetCapability(tcDPI,TwainSetCapabilityMode.Set);

// _twSession.SetProperties();

_returnFile = _imageDir + System.Guid.NewGuid() + ".tif";

_twSession.FastTransferMechanism = TwainTransferMechanism.File;

_twSession.FastImageFormat = RasterImageFormat.Tif;

_twSession.FastBitsPerPixel = 1;

_twSession.FastBufferSize = 0;

_twSession.FastUsePreferredBufferSize = true;

_twSession.EnableAcquireMultiPageEvent = false;

_twSession.GetProperties();

TwainImageResolution tir = new TwainImageResolution();

tir.BitsPerPixel = 1;

tir.HorizontalResolution = _dpi;

tir.VerticalResolution = _dpi;

tir.Unit = (int)TwainCapabilityValue.UnitInches;

_twSession.ImageResolution = tir;

_twSession.SetProperties();

_twSession.AcquireFast(_returnFile, ((_showTwainInterface == true) ? TwainFastUserInterfaceFlags.Show : TwainFastUserInterfaceFlags.None), _multiPage);

 
#4 Posted : Thursday, February 23, 2006 3:00:43 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

I am attaching a small DotNet Twain C# v14.5 project that shows how to use the above properties and methods with the twain session object.
Please check the project and let me know if you have any questions.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
DotNetTwainCSharp.zip (10kb) downloaded 49 time(s).
 
#5 Posted : Thursday, February 23, 2006 6:59:08 AM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


Thanks for the app, but it does not run for me.  I get the following.  I tried commenting the various properties being set to narrow it down, but the error still occurs.  Any ideas?

 

{"Required capability not supported" }

[Leadtools.Twain.TwainException]: {Leadtools.Twain.TwainException}

System.Object: {Leadtools.Twain.TwainException}

_className: null

_COMPlusExceptionCode: -532459699

_exceptionMethod: {System.Reflection.RuntimeMethodInfo}

_exceptionMethodString: null

_helpURL: null

_HResult: -2146232832

_innerException: { }

_message: "Error in the application."

_remoteStackIndex: 0

_remoteStackTraceString: null

_source: "Leadtools.Twain"

_stackTrace: {System.Array}

_stackTraceString: " at Leadtools.Twain.TwainException.CheckErrorCode(Int32 code)\r\n at Leadtools.Twain.TwainSession.AcquireFast(String baseFileName, TwainFastUserInterfaceFlags flags, Boolean multiPage)\r\n at Twain1.Form1.buttonAcquire_Click(Object sender, EventArgs e) in c:\\david\\testapps\\c_twain_example\\form1.cs:line 262"

_xcode: -532459699

_xptrs: 0

HelpLink: null

HResult: -2146232832

InnerException: { }

Message: "Required capability not supported"

Source: "Leadtools.Twain"

StackTrace: " at Leadtools.Twain.TwainException.CheckErrorCode(Int32 code)\r\n at Leadtools.Twain.TwainSession.AcquireFast(String baseFileName, TwainFastUserInterfaceFlags flags, Boolean multiPage)\r\n at Twain1.Form1.buttonAcquire_Click(Object sender, EventArgs e) in c:\\david\\testapps\\c_twain_example\\form1.cs:line 262"

TargetSite: {System.Reflection.RuntimeMethodInfo}

 
#6 Posted : Thursday, February 23, 2006 10:15:20 AM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


I found the line it was popping on.

twnSession.FastTransferMechanism = TwainTransferMechanism.Memory

I wonder why my system would die on this?

 
#7 Posted : Sunday, February 26, 2006 5:25:53 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

About the project, I checked the project before sending it. I think the problem might be related to one of the following:
- Using a different builds of to LEADTOOLS .Net DLLs. Please make sure you are using the latest LEADTOOLS .Net DLLs and you are referring to the correct DLLs from your machine. You can download the latest LEADTOOLS .Net v14 patch from our support site support@leadtools.com
- Also, Please make sure that the Leadtools.Kernel.dll on the same folder with the .Net DLLs.
- The problem might be related to the Twain driver that you use. Can you please try the same issue using different scanner or driver?

Please try the above instructions and let me know what will happen with you.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#8 Posted : Monday, February 27, 2006 10:11:56 AM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


Are there any patches available?  When I go to the support site, the only thing posted is this

"Patch Files
At this time, LEAD does not create patches files for Capture & Convert, Capture & Present, ePrint or any of the LEAD codecs. Direct notification will be provided to owners of these products if upgrades or new releases are available. If you have any questions, you may search the support forums or contact support@LEADTOOLS.com. "

 
#9 Posted : Monday, February 27, 2006 10:40:40 AM(UTC)

dhrncir  
dhrncir

Groups: Registered
Posts: 11


I also tried one of the online twaining devices, and I got the same error.
 
#10 Posted : Tuesday, February 28, 2006 2:43:05 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,328

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

Hello,

About the patches, to download the latest patches from our support site, please do the following instructions:
1. You have to login our support site:
Http://support.leadtools.com/
If you are not a registered user, you will need to register your email, and then login the support site.
2. After login, select "My Profile" tab and press "Add product registration" link.
3. Now, in the "Add a product registration" page insert your product serial#, and register your product.
4. After login, download you SDK patches from the "SDK Patches" tab.

Important Notes:
(1) After login and registration, if you can't see the "SDK Patches" tab, try to refresh the page. If the problem persists, then please send an email to our sales department at: sales@leadtools.com
Please let me know what will happen with you.

About the twain driver, it might be that your driver does not support this capability, because I am using the same sample with no problems on my machine.

Please try your code with the virtual Twain driver, you can get the Virtual TWAIN driver from "<http://www.twain.org/download.htm>", then click on "Download the Toolkit (Version: 1.7.0.3, Posted: February 18, 1999)" to download it.
 
Select this virtual scanner as the source scanner "TWAIN_32 Sample Source".
Use it to set and get the same capabilities and values that fail with LEADTOOLS.

Please try the above instructions and let me know what will happen with you.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
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-2019, Yet Another Forum.NET
This page was generated in 0.300 seconds.