|
It's seems that everything works perfect on vb.net but when twain windows comes up , the only buttons that works is the preview all the other does not respond (xp sp3), any idea i will really appreciate thanks a lot 
|
|
|
|
|
I had the same problem with Epson Perfection Scanner.
Here is the solution :
http://www.twainforum.org/viewtopic.php?p=7580&sid=db00d5fe948813eaf4e40aac8c340e9b
|
|
|
|
|
Hi
I am trying to capture fingerprint from fingerprint scanner . everything seems working , but facing problem when scanning for fingerprint. the UI window doesn't show up. It closes very quickly. anyone please guide me as it is very urgent for me.
thanks and best Regards,
|
|
|
|
|
Hi
This code works good. but i want to store image in the PDF format. is there any way for doing that?
Thanks
|
|
|
|
|
Transfer image file as memory file and then using any pdf .net library , convert that memory image into pdf. The 3 transfers that TWAIN support are Memory, file and there is one more.. but just forgot. 
|
|
|
|
|
PDF sharp was really easy to use for this. It could take a bmp and turn it into a physical pdf or a memory stream to send along.
|
|
|
|
|
could you please specify details on how to do this? or a sample? 
|
|
|
|
|
Hello, has anyone managed to get the possible resolutions? I don't know how to define TwCapability to alloc space according to the length of the resulting enum, nor how to read the values from the enum.
Has anyone a hint or sample how to read such capabilities?
Greetings Jörg
|
|
|
|
|
how to make scan files with multiple feeder and we give a default name
example 10 page
with name scan1 and automatically when scan name is scan1,scan2,scan3,etc
thanks so much
zimmy gurning
|
|
|
|
|
Hi,
I think I'm being a right thicko here and would appreciate some advice.
I'm trying to determine whether or not there is paper currently loaded in the feeder during the during the Aquire method so I've added CAP_FEEDERLOADED (0x1003) to TwainDefs and the following code to the Aquire method. I can't seem to figure out how to retrieve the value.
Thanks for your help,
Chris
TwCapability capFeederLoaded = new TwCapability(TwCap.CAP_FEEDERLOADED);<br />
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.GetCurrent, capFeederLoaded);<br />
if (rc != TwRC.Success)<br />
{<br />
CloseSrc();<br />
MessageBox.Show("FEEDERLOADED Failed");<br />
return false;<br />
}<br />
else<br />
{<br />
<br />
<br />
}
|
|
|
|
|
I've worked this one out. Here is the code, hope it helps someone else:
Thanks to spike on www.twainforum.org
Chris
TwCapability capFeederLoaded = new TwCapability(TwCap.CAP_FEEDERLOADED);<br />
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capFeederLoaded);<br />
if (rc != TwRC.Success)<br />
{<br />
CloseSrc();<br />
MessageBox.Show("FEEDERLOADED Failed");<br />
return false;<br />
}<br />
else<br />
{<br />
<br />
IntPtr pv = Twain.GlobalLock(capFeederLoaded.Handle);<br />
bool bFeederLoaded = (0 != (short)Marshal.ReadInt32(pv, 2));<br />
Twain.GlobalUnlock(capFeederLoaded.Handle);<br />
Twain.GlobalFree(capFeederLoaded.Handle);<br />
<br />
if (!bFeederLoaded)<br />
{<br />
TwCapability capFeederLoaded = new TwCapability(TwCap.CAP_FEEDERLOADED);<br />
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, capFeederLoaded);<br />
if (rc != TwRC.Success)<br />
{<br />
CloseSrc();<br />
MessageBox.Show("FEEDERLOADED Failed");<br />
return false;<br />
}<br />
else<br />
{<br />
<br />
IntPtr pv = Twain.GlobalLock(capFeederLoaded.Handle);<br />
bool bFeederLoaded = (0 != (short)Marshal.ReadInt32(pv, 2));<br />
Twain.GlobalUnlock(capFeederLoaded.Handle);<br />
Twain.GlobalFree(capFeederLoaded.Handle);<br />
<br />
if (!bFeederLoaded)<br />
{<br />
CloseSrc();<br />
MessageBox.Show("NO PAPER DETECTED");<br />
return false;<br />
}<br />
<br />
}<br />
}<br />
<br />
}
modified on Monday, February 14, 2011 9:42 AM
|
|
|
|
|
Thank you very much Chris Shaw. This is help me to avoid high memory usage while scanning more than 20 documents in a single scanning.
|
|
|
|
|
Hello guys ,
i have developed application which detect scanner and i do some business process now problem is my application can detect network scanner as i use same library which .Net master made ,but what is i want to detect scanner which is in VPN in other country.I am connected to VPN Scanner and install proper driver for scanner as well but my application cant detect that VPN Scanner..What is the problem what else need to detect remote scanner ? please help me .
|
|
|
|
|
Hi,
I want to show driver interface to capture images.
DSuserif( appid, srcds, TwDG.Control, TwDAT.UserInterface, TwMSG.EnableDS, guif ) gives success return without waiting for the driver interface to capture image.
Please advice,
Thanks in advace
|
|
|
|
|
I want to access network scanner from Twain, i unable to access the scanner from client machine where i run the twain application
|
|
|
|
|
I want to pass code control scanning, but not through the scan button in UI to scan
|
|
|
|
|
help ,I want to control scan in code, but not show in the UserInterface .
|
|
|
|
|
If you have Library CtwainDefs, there is a Class TwUserInterface. In your form create Object of TwUserInterface and then you can access to ShowUI and ModalUI
|
|
|
|
|
Hello,
on a Windows 7 system (64 bit) I have a problem with this code in TwainGui:
01 public void Acquire()
02 {
03 TwRC rc;
04 CloseSrc();
05 if( appid.Id == IntPtr.Zero )
06 {
07 Init( hwnd );
08 if( appid.Id == IntPtr.Zero ) return;
09 }
10 rc = DSMident( appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds );
11 if( rc != TwRC.Success )
12 return;
...
At line 10 the application crashes. I use Visual Studio 2010 Ultimate. I have tested all available .NET Framework 2.0, 3.5 and 4 and all plattform configurations. The orginal binary of TwainGui works perfectly. What's wrong?
Best regards
|
|
|
|
|
HI,
you must modify in TwainDefs.cs this line code :
[StructLayout(LayoutKind.Sequential, Pack=2, CharSet=CharSet.Ansi)]
internal class TwIdentity
{
public uint Id;
Then you must modify in TwainLib.cs all refercede line example :
if (appid.Id == 0)
I made this change and now work fine also in windows 7 64 bit.
I hope this help
best regard
daniela
|
|
|
|
|
I tried this but i have an error in the line
public void Init(IntPtr hwndp)
{
Finish();
TwRC rc = DSMparent(appid, IntPtr.Zero, TwDG.Control, TwDAT.Parent, TwMSG.OpenDSM, ref hwndp); //<--- HERE!
//the error is BadImageFormatException
{"Tentativo di caricare un programma con un formato non corretto. (Eccezione da HRESULT: 0x8007000B)"}
Thanks a lot
liffo
|
|
|
|
|
I am trying to write the scanned file to disc automatically after the scan is completed. My problem is writing the IntPtr to a FileStream. I can’t seem to get the right sequence of what needs to be done. Any help in pointing me in the right directions would be appreciated.
|
|
|
|
|
Hello, if someone can help me! I am trying to catch a exception when device is not found, I tried with try and catch block, when device is connected everything is working fluently but when device is not connected program freezes. With Wia there is exception when device is not connected, but I can't find how to solve this with twain. If someone know how to fix this I would be regardless.
|
|
|
|
|
Hi everyone,
I solved the puzzle. This is the code contains duplex, pixeltype, deskew, scan ahead, border detect, resolution.
It works successfully.
For Acquire method (TwainLib) :
// MAIN CAP AND MULTI SCAN
TwCapability cap = new TwCapability(TwCap.XferCount, -1);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("MAIN CAP FAILED");
return;
}
// DUPLEX
TwCapability capDuplex = new TwCapability(TwCap.CAP_DUPLEXENABLED, 1, true);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDuplex);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("DUPLEX FAILED");
return;
}
//// 0 = BW | 1 = Gray | 2 = Colour
TwCapability capPixelType = new TwCapability(TwCap.IPixelType, 1, TwType.UInt16);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capPixelType);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("PIXEL TYPE FAILED");
return;
}
// BORDER DETECTION
TwCapability capBorder = new TwCapability(TwCap.ICAP_AUTOMATICBORDERDETECTION, 1, TwType.UInt16);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capBorder);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("BORDER DETECT FAILED");
return;
}
//// Set the X resolution
TwCapability capResX = new TwCapability(TwCap.ICAP_XRESOLUTION, 100, TwType.Fix32);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capResX);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("XRES FAILED");
return;
}
//// Set the Y resolution
TwCapability capResY = new TwCapability(TwCap.ICAP_YRESOLUTION, 100, TwType.Fix32);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capResY);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("YRES FAILED");
return;
}
// DESKEW
TwCapability capDeskew = new TwCapability(TwCap.ICAP_AUTOMATICDESKEW, 1, TwType.Fix32);
rc = DScap(appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, capDeskew);
if (rc != TwRC.Success)
{
CloseSrc();
MessageBox.Show("DESKEW FAILED");
return;
}
For TwCapability internal class (TwainDefs):
internal class TwCapability
{ // TW_CAPABILITY
public TwCapability(TwCap cap)
{
Cap = (short)cap;
ConType = -1;
}
public TwCapability(TwCap cap, short sval)
{
Cap = (short)cap;
ConType = (short)TwOn.One;
Handle = Twain.GlobalAlloc(0x42, 6);
IntPtr pv = Twain.GlobalLock(Handle);
Marshal.WriteInt16(pv, 0, (short)TwType.Int16);
Marshal.WriteInt32(pv, 2, (int)sval);
Twain.GlobalUnlock(Handle);
}
public TwCapability(TwCap cap, short sval, TwType twType)
{
Cap = (short)cap;
ConType = (short)TwOn.One;
Handle = Twain.GlobalAlloc(0x42, 6);
IntPtr pv = Twain.GlobalLock(Handle);
Marshal.WriteInt16(pv, 0, (short)twType);
Marshal.WriteInt32(pv, 2, (int)sval);
Twain.GlobalUnlock(Handle);
}
~TwCapability()
{
if (Handle != IntPtr.Zero)
Twain.GlobalFree(Handle);
}
public TwCapability(TwCap cap, short sval, bool blnType)
{
Cap = (short)cap;
ConType = (short)TwOn.One;
Handle = Twain.GlobalAlloc(0x42, 6);
IntPtr pv = Twain.GlobalLock(Handle);
Marshal.WriteInt16(pv, 0, (short)TwType.Bool);
Marshal.WriteInt32(pv, 2, (int)sval);
Twain.GlobalUnlock(Handle);
}
public short Cap;
public short ConType;
public IntPtr Handle;
}
For Twcap ( TwainDefs) :
internal enum TwCap : short
{
XferCount = 0x0001, // CAP_XFERCOUNT
ICompression = 0x0100, // ICAP_...
IPixelType = 0x0101,
IUnits = 0x0102,
IXferMech = 0x0103,
CAP_AUTOSCAN = 0x1010,
CAP_DUPLEXENABLED = 0x1013,
ICAP_XRESOLUTION = 0x1118,
ICAP_YRESOLUTION = 0x1119,
ICAP_SUPPORTEDSIZES = 0x1122,
ICAP_AUTOMATICBORDERDETECTION = 0x1150,
ICAP_AUTOMATICDESKEW = 0x1151
}
|
|
|
|
|
can you tell me how get the capability of the scanner?
Although i know how to get the desired Item , but I don't know how to read the value.
|
|
|
|
|