GithubHelp home page GithubHelp logo

twain-samples's Introduction

TWAIN Samples

Use the TWAIN 2 sample data source and application, to test your TWAIN project, or as templates to incorporate TWAIN into your graphic applications or Scanner drivers. The samples are released as open source software and uses a Modified BSD licenses.

The project was last built and tested using QT 5.9.9, and setting QTDIR to C:\Qt\Qt5.9.9\5.9.9\msvc2017_64 on a Windows 10 system.

It has been fixed so a development system is not needed when installing using the .msi files.

Features

  • Software only virtual scanner
  • Cross platform TWAIN DS and Application

twain-samples's People

Contributors

kenya31 avatar kolomiets avatar mihailmikov avatar mlmcl62 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twain-samples's Issues

Repo doesn't have releases

Repo doesn't have a release dir.
I don't like to build it and install all what needable for it.
Please create a release in a github page of your project.

[Bug] Scanner Error and Status messages get lost [sf#29]

Reported by jim0watters on 2010-04-22 15:47 UTC
- Better handling of error, warning, and status messages with condition codes
- printError used throughout base class retrieves the last condition code and discards it
- make printError virtual so derived classes can display the message plus have access to the condition code.
- Add control to MFC Sample app to displaying the last or current status.

[Bug] Y Resolution not updated following settings dialog [sf#36]

Reported by bartlettpsj on 2014-01-05 17:45 UTC
Only the ICAP_XRESOLUTION is updated in Qt_MainForm. As a quick hack, which seems to work, I added m_pUI->SetCapValueFloat(ICAP_YRESOLUTION,val.toInt()); to void MainForm::on_pComboBox_Resolution_activated(int _nIndex), but would rather this be applied by someone who knows this codebase.

[Bug] Undefined UNUSEDARG macro when compiling in Linux [sf#42]

Reported by silvernexus on 2016-02-02 19:37 UTC
When compiling in Linux, the UNUSEDARG macro used in Twain_App_sample01/src/main.cpp is not defined.
This can be solved by defining UNUSEDARG in common/Common.h.

Attached is a diff of how I made this work. Probably needs testing to ensure this doesn't break other builds.

[Bug] Negotiation allowed in state 5... [sf#32]

Reported by mlmcl on 2011-12-16 09:53 UTC
Code was set to allow negotiation for both states 4 and 5, when it should only be 4 (unless CAP_EXTENDEDCAP is set, which isn't the case for the sample). A fix has been made...

This application failed to start because it could not find or load the Qt platform plugin "windows" > in ""

I installed the binaries for the Data Sources in 32 bit and 64 bit. The installation went fine. When I use the Twain App then I can see the data sources; I tested the Twain App on 32 bit and 64 bit architecture. I can also connect to the data sources on both architectures.

However, when I want to perform a scan then I run into an unhandled exception and the following output is displayed (again on both architectures):

This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".

Reinstalling the application may fix this problem.

Unfortunately I have no experience with Qt and don't know what the error message means exactly in this case. My guess is that I have to install Qt or part of Qt and set it up in order to make this work.

It would be great if this can be addressed; e.g. explaining in the README file what to install and how to set up so that the virtual Data Sources can perform a scan.

[Bug] Secret Istall! [sf#8]

Reported by awneil on 2009-09-08 07:17 UTC
I downloaded & ran the sample installer.

It gave me no indication whatsoever of where it would install, and no chance to change it!

First a question: Where did it go??

But please fix this so that, at the *very* least, it says where it will install and, vastly preferable, it allows the user to choose the location.

Why does it have to be an installer at all? Can't it just be supplies as a ZIP or whatever - as is usual for source code?

[Bug] Always crashes with some models of scanners [sf#37]

Reported by msdi on 2014-03-27 10:46 UTC
Hi,

The twain sample app is really useful to debug software when it works. The only problem is that it crashes everytime on certain types of scanner as soon as you connect to the datasource.

The cmd version doesnt crash and works well but naturally don't give as much information and the mfc version.

We have a twain application using dynamsoft web twain ocx and their official method of debugging is to download twain sample app. Our user based as about 2500 installs so when we need to debug we install twain sample app. Most of the time it works very well, but everytime we see an
HP Office Jet (6500,7500,8500,8600) it just crashes as soon as we open the datasource.
The same happens with Kodak i1220 Plus Scanner, it also happens on other models, but these are frequently seen and crash everytime.
It does this on xp, vista, windows 7 and windows 8 so the os doesnt seem to be the cause.

Is that a known issue ? If not, how can I help you ? I can easily test if you give me some tests you want me to do for you.

Regards

[Bug] Error in frame constrain function [sf#13]

Reported by brainsucker on 2009-09-14 18:46 UTC
Several errors were introduced to function CTWAINDS_Base::ConstrainFrameToScanner at rev.42, for example:
if condition compares _nframe.nRight with fMaxValue*1000, but uses just fMaxValue to set frame right border (introducing 1000x error in some cases).
Same situation for every changed line (at rev.42) at this function.

if(pPhysicalWidth && true == pPhysicalWidth->GetCurrent(fMaxValue) && (int)fMaxValue*1000 < _frame.nRight)
{
_frame.nRight = (int)fMaxValue;
bChanged = true;
}

[Bug] Native transfer DIB handle doesn't respect GlobalLock call [sf#31]

Reported by michalzaganczyk on 2011-11-02 09:15 UTC
It seems that the DIB allocated by the sample data source in native transfer mode is allocated with GPTR flag. The result is that the DIB lock count returned by GlobalFlags(hDIB) is always 0, regardless of GlobalLock(hDIB) calls.

GPTR flag is a combination of GMEM_FIXED and GMEM_ZEROINIT. This makes the GlobalLock calls is pointless on the DIB handle, because for memory allocated with these flags, GlobalFlags function always returns 0, what makes lock count checking impossible.

This can lead to errors in software which relies on tracking of the DIB's lock count (ie. the asynchronous DIB processing in other thread).

I think the bug is here (src/DSMInterface.cpp, lines 215-230):

//////////////////////////////////////////////////////////////////////////////
// The following functions are defined in the DSM2,
// For backwards compatibiltiy on windows call the default function
TW_HANDLE _DSM_Alloc(TW_UINT32 _size)
{
if(g_DSM_Entry.DSM_MemAllocate)
{
return g_DSM_Entry.DSM_MemAllocate(_size);
}

#ifdef TWH_CMP_MSC
return ::GlobalAlloc(GPTR, _size); /* ========== GPTR IS SET HERE ========== */
#endif

return 0;
}

[Bug] Sample DS blocks image display with browser application... [sf#39]

Reported by mlmcl on 2014-11-25 14:42 UTC
This is the CAPSYS issue. I'm dropping this in here as a reminder for Jon to take a look at the issue, to see if he identifies a fix. The problem is easy to reproduce. Bring up the app, set the driver UI to come up, fix the sample driver to transfer multiple images. It's not possible to see the effect, since the sample uses the same image for all transfers, but monitoring the display window with Spy++ shows that after five seconds the browser is no longer displaying each transfer. At the end of the session the display comes back to life, showing the last one or two images. The working theory is that there may be a COM / WaitForSingleObject issue, but that's about all we have at this point. I do have a workaround that I've developed using CreateWindow, but it's about as subtle as a bulldozer in a china shop...

[Bug] DS sample DPI/resampling bug [sf#1]

Reported by brainsucker on 2009-02-08 16:28 UTC
Function FreeImage_ConvertTo24Bits resets DPI of dib to some constant value (indepndent of source image DPI), like 72 for me (current GDI device (monitor) resolution?). Noticed that during extending sample ds to provide arbitary images (thru OpenFileDialog), and getting very long resampling times (for 300 dpi from 2000x3000 -> 8000x1000 is a big piece of work).

solved easily by moving GetDotsPerMeterX/Y (together with new size calculations, anyway they are independent of DPI) before Convert call.

Need help to built TWAIN and establish environment

Dear TWAIN fellows,
I have developed many applications using ISIS protocol which is propriety and black box, now I want to go with TWAIN /SANE to develop my own interfacing application for a scanner. please help me or give me documentation in detail to how to configure twain DS and DSM with my application on windows platform (specially to configure the development environment and mandatory requirements). The details provided in the twainsample is confusing me.
Regards,
Kamran

[Bug] twain.h is missing from .zip [sf#34]

Reported by spike0xff on 2012-08-10 20:12 UTC
In VS2008, both projects in the solution depend on twain.h - TWAIN_APP_CMD lists it explicitly as a Header File, TWAIN_App_mfc just includes it with #include. Neither project will build without it.

I guess I'm assuming that this thing should just build out of the box. Why not?

If you add twain.h to the Common folder, it takes care of this problem.

[Bug] DS must return TWCC_BADVALUE if frame is out of range [sf#18]

Reported by mihailm on 2009-10-26 13:57 UTC
If the requested values exceed the maximum size the Source can acquire, set the
pImageLayout->Frame values used within the Source to the largest extent possible within the
axis of the offending value. Return TWRC_FAILURE with TWCC_BADVALUE.

[Bug] dlclose is used without linging libdl [sf#43]

Reported by silvernexus on 2016-02-02 19:51 UTC
When compiling in Linux, the linker errors out due to undefined references to dlclose.

Adding -ldl to the project definition corrects the linker error.

Added a diff to reduce ambiguity of the fix.

[Bug] Compilation error in Linux from typedefs in TWAIN-Samples/common/CTiffWriter.h [sf#41]

Reported by silvernexus on 2016-02-01 15:29 UTC
When building the samples for Linux, the compiler generates an error in TWAIN-Samples/common/CTiffWriter.h because it has not had uint16_t or uint32_t defined. These are both defined in inttypes.h. Just include that file in the non-win32 build, and it builds.

I attached a diff of the file for good measure, in case my explanation was unclear.

app_sample cannot read ds_sample

hi.
im beginner of twain driver.
first of all, i downloaded this project and compiled successfully.
i used vs2015 and qt4.8.7 on windows10 x64.

i moved compiled TWAINDS_Sample32.ds to "c:\windows\twain_32\sample2" and then that folder is contain FreeImage.dll, TWAIN_App_mfc.exe, TWAINDS_Sample32.ds, TWAINDSM.dll

but when execute TWAIN_App_mfc.exe, the list has nothing and two buttons are disabled.
am i miss something?

and where can i see some guides or what?
i hope you understand my question.

thank you.

[Bug] Get Capability returns "unrecognized item type" [sf#38]

Reported by ad-viper on 2014-07-31 14:20 UTC
Hello,

I´m using your twaincstool to implement some scan functions into one program. The problem is, that I can´t figure out, why the enquiries of the capabilities are not working.
As you can see in the first screenshot(output_messages), everything (expect get Entry, it returns BADPROTOCOL) till the capability enquiries works fine.
The enquiry of the Capability regarding xfercount, current capabilities, supported capabilities are in the other screenshots(getCap, get_current_caps,supported_capabilities).
I´ve read the TWAIN-2.3-Spec and searched some time for a solution, I didn´t find anything…
The Problem is, that the capability request fails at the end – when the method want´s an item type, it get´s a number, where I wrote an string like “TWTY_UINT16”.
On screenshot “marshal” in the red square occurs the problem(I think “ItemType” should be a string like “UINT16”, “STR32”, “INT32”, but it´s an number – maybe the address and it maybe contains the needed item type).
Finally that function returns the “ItemType”(random number) and the number is being appended to a string screenshot “TWTY”.

It would be nice, if you could overlook my codesnippets and give me an advice, how to solve my problem. :)

Greetings DK

[Bug] Use of untemplated min() is ambiguous [sf#44]

Reported by silvernexus on 2016-02-02 19:56 UTC
Use of untemplated min in Twain_App_sample01/src/TwainApp.cpp is ambiguous and creates compiler errors in GCC 4.8.

Use of templated min silences these errors. I made it work by templating to TW_UINT32, but should be tested for good measure on other systems.

[Bug] Cannot find FreeImage virtual scanner [sf#40]

Reported by syakimenko on 2016-01-28 13:34 UTC
Hello!

Sample app cannot find FreeImage virtual scanner.

What I do:

  1. Install Twain sample app;
  2. Run this one in GUI and in console;
  3. See empty list of available scanners in both.

What should be:
FreeImage virtual scanner is in list of available scanners in GUI and in console app.

I noticed the bug in Win 7 and Win 10 OS with x32 and x64 versions of installer.

Thank you for your help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.