TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

alvise

  • Profile
  • Topics Started
  • Replies Created
  • Engagements
  • Favorites

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 23 total)
1 2 →
  • Author
    Posts
  • February 16, 2011 at 3:14 pm in reply to: Scanner detection problem #25379
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    check that the port number through which your app is contacting the remote scanner is opened. If not, contact your VPN admin and ask him to open that port. Hope this helps. A.

    October 15, 2008 at 2:45 pm in reply to: Please tell me how Duplex scanning with C# program? #23287
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    A little note about duplex scanning: since my beginnings I have always been using simplex scanners to get both sides of the documents. In every application that I have programmed, my software first asks for the first pass (all front sides of the pile of documents). At the end of the first pass the operator is asked to reinsert the pile of sheets in the ADF, and then the application makes a second pass to scan the back side of the sheets.

    Then the application makes the following software operations:

    a) makes sure that the number of sheets in both passes are the same

    b) numbers the output TIFF files in the correct order (this is necessary, of course, because during the second pass the sheets are scanned in reverse order, plus it is necessary to anternate one front and one back according to odd and even pages).

    In normal office activity, a secretary deals with both sided documents in a minority of cases. This is why my approach works fine for my customers.

    My trick cuts hardware costs quite a lot. (Also in the early ’90s duplex scanners were difficult to find and very expensive.)

    Why give so much money to the scanner manufacturers when you can have your customers saving on hardware, and shifting that saving into your earnings ?

    So I never worried about programming duplex scanners… and this is my suggestion for everyone !

    For other useful software tricks about scanning documents have a look at http://www.gentle.it/alvise/ffsplitad.htm and http://www.gentle.it/alvise/ffsplitbc.htm (there is a sketch linked in the “specification” section of these web pages that explains it well).

    Regards. Alvise.

    May 23, 2008 at 8:02 pm in reply to: Simple capability setting #24509
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Hi Gabe. Yesterday I received the Kodak i1210 scanner, I’ve installed it, and now I finally can scan a page and get the bitmap.

    But the fact is that the image is mirrored both vertically and horizontally (plus black and white pixels are swapped, but this is less important).

    Is there anything that I am missing ? Should I write a routine to reverse the image upside down, left to right, and to get the proper pixel colors ? Why doesnt’ the scanner provide the correct image straight out of the scan ?

    Thanks. Alvise.

    May 23, 2008 at 7:34 pm in reply to: use IMAGENATIVEXFER ,how to save the image to disk #24525
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    see TWAIN 1.9a Specification page 2-22

    Alvise.

    May 20, 2008 at 3:34 pm in reply to: Interpreting Capability results in TWON_ARRAY #24515
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    The return value from the twain entry point (nCRet) is zero (TWRC_SUCCESS) when the call has been successful. A return value above zero means failure: check the twain status to know what happened.

    You should change “if (nCRet)” into “if (!nCRet)” for your code to be OK.

    And you’ll discover that the call has gone wrong, but you think it was OK, and the parameter list that you read is not the real one.

    Good luck with twain. Alvise.

    May 19, 2008 at 7:48 am in reply to: Bad TWAIN structure definition #24494
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Toolkit sample ? I didn’t notice it. Today I’ll re-inspect the package.

    Thanks for the hint. Alvise.

    May 19, 2008 at 7:45 am in reply to: twain and winXP #24514
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    I am not in possess of any MicroSoft compiler. But even if I had, I’d not used it because I need to integrate the resulting code into my old DLL (that I have also published for free at http://www.gentle.it/alvise/fflibdll.htm).

    Yesterday I happened to download the AIIM MS61 API specification (used to implement ISIS applications) and it looks ways more simple than twain.

    But I scraped my PC and couldn’t find any system DLL which impements that API, even after installing the ISIS driver of my scanner.

    If I could find such a DLL I could give it a try.

    Regards. Alvise.

    May 19, 2008 at 6:46 am in reply to: twain and winXP #24512
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    I think you’re right. I am now developing in assembly with MASM32. But I have been programming in C++ with the Borland compiler for a decade and never got into major troubles.

    Regards. Alvise.

    May 19, 2008 at 6:32 am in reply to: Simple capability setting #24507
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Hi Gabe:

    >> try the same code on the same hardware
    >> same drivers with a different compiler

    I already changed the compiler. Now I am developing in assembly with the old good MASM32, and the results are better: no more need to patch structures. But getting x and y resolution always returns a container structure that is different from the one described in twain.inc

    >> And on the side, what device are you test with?

    Avision AV 820C. But I have ordered a Kodak i1210 and it should be arriving this week.

    I am also planning to change the development PC and install another copy of WinXP.

    Regards. Alvise.

    May 11, 2008 at 9:01 am in reply to: unsupported 16-bit application Twunk_16.exe Need help #24502
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Try to open a WinXP virtual machine and run the software in that shell.

    Alvise.

    May 9, 2008 at 8:24 pm in reply to: Bad TWAIN structure definition #24491
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Yes Jim, the pragma directive is exactly the one that you have typed. Afterall it comes with the original twain.h, and I have no reason to change it. And in fact I haven’t.

    I confirm what you say, __BORLANDC__ is the compiler identifier, and for the Borland’s compiler the directive is #pragma -a2 and not #pack (2).

    And looking into the data segment, the structures appear to be word aligned (every 2 bytes, even addresses, according to the #pragma -a2 directive). But the fact is that words in the data segment appear to be swapped.

    Thanks for your interest. Alvise.

    May 9, 2008 at 7:15 am in reply to: How to fit a TW_FIX32 value into a TW_ONEVALUE #24498
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    For those who are interested: I further investigated the container that is passed from the Data Source to the application (MSG_GET) and vice-versa (MSG_SET).

    When I look into memory at the address allocated for the TWON_ONEVALUE container during the MSG_GET of ICAP_XRESOLUTION I can see:

    0x02580000
    0xXXXX0007

    where the first doubleword is Frac+Whole, and the preceeding word (0x0007) is TWTY_FIX32 twain type. Frac, the upper word, is 0x0258 (=600 dpi) and I already said in my previous post that Whole and Frac get exchanged. The word 0xXXXX that preceedes the container is not part of it, but for the sake of completeness its values is 0x0032.

    When I allocate the container to perform a MSG_SET of the ICAP_XRESOLUTION, on the contrary, the memory looks like this:

    0x000000C8
    0xXXXX0007

    (0x00C8 = 200 dpi) and when I call the DSM entry point I invariably get a TWCC_BADVALUE return code, even if I exchange the words in the Item (0x00C80000) to mimic the MSG_GET arrangement.

    By manually changing the contents of the memory, I discovered that the only way to receive the TW_OK status when returning from a call to the DSM entry point, is to set 0xXXXX to the exact same value that it is set when returning from a MSG_GET (0x0032). Any other value makes the MSG_SET fail.

    Nonetheless, returning an OK twain status when returning from such a call, the resolution is supposed to be set to the new value… but as I make a successive query (with a further MSG_GET), the resolution is still set to 600 dpi (with Whole and Frac exchanged).

    May 9, 2008 at 5:17 am in reply to: What`s the meaning of the MSG_GET #24501
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33
    Quote:
    Is that mean MSG_GET will get two value(the default one and the current one)?

    The retrieved values depend on the capability that you’re querying and the container that you’re using to retrieve the values.

    If you use a container that can contain only one value you’ll retrieve exactly one value.

    May 8, 2008 at 7:05 pm in reply to: How to fit a TW_FIX32 value into a TW_ONEVALUE #24497
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Hi Gabe, following your suggestion I had a closer look at the free EzTwain package that comes from Dosadi and I discovered how to fit a TW_FIX32 into the Item member of a TW_CONTAINER structure. It’s very simple.

    Since the Item is a doubleword (32 bit) and each member of the TW_FIX32 structure is a single word (16 bit), simply memcpy 16+16 into 32 bit when setting the capability, and memcopy 32 bit into 16+16 when getting the capability (in C or C++ it needs appropriate casting, of course).

    The EzTwain source code also shows that whatever the capability (TW_UINTxx or TW_FIX32), the function named “TWAIN_SetCapOneValue” gets the capability parameter as a long (=32 bit), then assigns it to Item with the simple assignment operator (=). Very clever.

    And also this demostrates that when using a TW_FIX32 type, you can deal with it as if it were a regular long type as long as the Frac member is zero. In fact Frac is set in the upper 16 bit of the long, and Whole in the lower 16 bit.

    Well, once I understood how to deal with TW_FIX32 into the Item member of a TW_CONTAINER structure, I have decided to get the current value of the ICAP_XRESOLUTION of my Avision 820C scanner, just to see what it looks like, and subsequently try to set my own value.

    The DG_CONTROL, DAT_CAPABILITY, MSG_GET triplet works fine but the TW_FIX32 resolution value that I get looks like this:

    resolution.Whole = 0;
    resolution.Frac = 600;

    Since the default resolution of the Avision 820C scanner is 600 dpi, it is evident that the two members of the structure have been exchanged. Ahhh, this is why every time I try to SET the resolution I get a TWCC_BADVALUE condition code in return ! (I thought).

    But to make things short, whatever combination of Whole and Frac values I try to set into my scanner, the return status is always the same: bad value.

    So I am currently desperate, but will not surrender.

    May 8, 2008 at 6:11 pm in reply to: ICAP_ROTATION No effect #24499
    alvise
    Participant
    • Topics - 10
    • Replies - 23
    • Total Posts - 33

    Your code looks pretty good. “Item”, also, is set correctly. Are you setting this capability in TWAIN state == 4 ???

    I suppose you get rc > 0 after calling the DSM entry point.

    Have you checked the TWAIN status using this triplet: DG_CONTROL, DAT_STATUS, MSG_GET ? Which is the status that you get ?

    (Currently I am receiving several TWCC_BADVALUE, but just when I try to set a TW_FIX32 capability.)

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 23 total)
1 2 →

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • TWAIN for dental imaging integration
  • PDF/R For who and where?
  • Making searchable PDF with PDF/R
  • Backward compatibility with PDF/A and traditional PDF
  • could not open the twain source. Make sure there is a valid source for your sca
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in