in

Archived Data Techniques Forums

Imageman.net TWAIN - Setting TWAIN properties

Last post 06-25-2008 11:56 AM by ejw. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 06-20-2008 11:58 AM

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Imageman.net TWAIN - Setting TWAIN properties

    Hi,

    Been working a couple days with the demo 2.5x Imageman.Net TWAIN.
    Using VB.NET 2005

    Scanner is a network connected HP All-in-one 2610 Latest 4.70 Drivers

    What is happening is that the setting of TWAIN parameters is causing the display of a Dialog, I assume is coming from the HP TWAIN driver, that says, "The imaging device is ready to scan..." and has SCAN and Cancel Buttons.

    This dialog is appearing before the program gets to the TWAIN.SCANPAGE command.

    If SCAN button is clicked, the program is okay. If UI is enabled, the HP SCAN UI is displayed. If UI is not enable the scan just happens without a progress indicator to the user)

    But if CANCEL is clicked and the next line sets another parameter, the dialog is displayed again.
    This Process will repeat for the setting of other parameters and the clicking of the Cancel button.

    Any idea if this is a quirk of the HP TWAIN scanning interface?

    Any other ideas?

    I have tried to use the ScanCancelled event to trap the Cancel button, but that does not look to work until AFTER the TWAIN.SCANPAGE has been called.

    Thanks.

     

     

  • 06-23-2008 8:40 AM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Imageman.net TWAIN - Setting TWAIN properties

    Follow up.

    Over the weekend I tried out a Lexmark x2690 printer/scanner.
    Good news is that I do not get the dialog box each time a Twain parameter is set.
    Bad news is that I am receiving the ScanCancelled event at the end of each scanned page.

    I noticed in the vb2003 vbDemo program that it uses Events and that the vb2005 version of vbDemo does not use Events.
    I did not see any 2005 demo program that uses events.
    Is the use of events being depreciated?

    I noticed in the vb2003 demo the CheckForAndReportLastError Sub.
    Even when running the vb2003 VBDEMO program it get the ScanCancelled event and the
    LastError.Description, LastError.ReturnCode and LastError.Condition code are all returning Success or Okay.

    When I click the Cancel button on the "scan in progress" dialog, the ScanCancelled event fires right away but again all the LastError codes Return Success or Okay. Means I cannot trap scancelled as I am getting the same result for a scanned page or the cancel button being pressed.

    With the x2690, after doing the first twain.scanpage, i have to do a twain.closesource before I can do another twain.scanpage.
    If I do not the second and subsequent twain.scanpage(s) do not do anything.

    Though the x2690 does not have a sheet feeder, I did attempt to use the ScanAll with maxpages = 4 and did not appear to work as I expected.
    It only scanned a single page and again fires the scancancelled event.

    Is the inconsistency of the TWAIN just a "nature of the beast" effect of how one vendor implents it vs another?

    The x2690 shows up in Scanners as both a TWAIN and a WIA scanner

    I noticed in the following thread that it is suggested to use the 'Native' Twain driver, and I am selecting the TWAIN source, not the WIA source.

    http://forums.data-tech.com/forums/t/3825.aspx 

    Could it be possible that the x2690 TWAIN driver is using the TWAIN-Passthrogh MODE, that is a part of WIA and simply passing the TWAIN requests thorugh to the WIA driver?

    Is there some way I can check to make sure I am using a 'native' twain driver?

     

     

     

  • 06-23-2008 4:38 PM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Imageman.net TWAIN - Setting TWAIN properties

    Monday Follow up.

    Today I tried an HP L7650 All in one Scanner.

    It functions a tad better.
    Unlike the HP 2610 and like the Lexmark x2690 it does not display the extra dialog when applying settings.

    Correction: And like the Lexmark x2690 it does require the twain.Closesource after each twain.scanpage.
    The L7650 is also firing the ScanCancelled event after every page.

    Looks like the Lexmark x2690 and L7650 are behaving the same with the Twain Driver.

    This one does have an ADF, will work with that tomorrow.
    Twain Log Follows:

    ====================================================================
    == Return Code set during Select Scanner         EJW 01.21.08     ==
    ====================================================================
    == DTI.ImageMan.Twain, Version=2.0.0.0, Culture=neutral, PublicKeyToken=3ff15c974c5defd8
    == Win32NT Version 5.1.131072.2600
    == Common Runtime Version 2.0.42.50727
    == Log Open: 5:28:08 PM Monday, June 23, 2008

    State 3 Twain Triplet: Control, Identity, OpenDS -
     Identity Structure:
      Id:              1018
      Version:         1.0
      Language:        UsEnglish
      Country:         Usa
      Info:            December, 2001
      Protocol:   1.9
      SupportedGroups: 3
      Manufacturer:    Hewlett-Packard
      ProductFamily:   All-in-One
      ProductName:     Officejet Pro L7600 TWAIN
     [Success]
    State 4 Twain Triplet: Control, Capability, Get - Capability: XResolution, Container: Range -
     Range:
      ItemType:        Fix32
      Min:             12.0
      Max:             16000.0
      Step:            1
      Default:         200.0
      Current:         200.0
     [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: XResolution, Container: One - OneValue: ItemType: Fix32 Item: 200 [Success]
    State 4 Twain Triplet: Control, Capability, Get - Capability: YResolution, Container: Range -
     Range:
      ItemType:        Fix32
      Min:             12.0
      Max:             16000.0
      Step:            1
      Default:         200.0
      Current:         200.0
     [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: YResolution, Container: One - OneValue: ItemType: Fix32 Item: 200 [Success]
    State 4 Twain Triplet: Control, Capability, Get - Capability: PixelType, Container: Enum -
     Enumeration:
      ItemType:        UInt16
      Count:           4
      Current:         2
      Default:         2
      Items:           0 1 2 3
     [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: PixelType, Container: One - OneValue: ItemType: UInt16 Item: 1 [Success]
    State 4 Twain Triplet: Control, Capability, Get - Capability: CurrentUnits, Container: Enum -
     Enumeration:
      ItemType:        UInt16
      Count:           4
      Current:         0
      Default:         0
      Items:           0 1 3 5
     [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: CurrentUnits, Container: One - OneValue: ItemType: UInt16 Item: 0 [Success]
    State 4 Twain Triplet: Control, Capability, Get - Capability: PixelFlavor, Container: Enum -
     Enumeration:
      ItemType:        UInt16
      Count:           2
      Current:         0
      Default:         0
      Items:           0 1
     [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: PixelFlavor, Container: One - OneValue: ItemType: UInt16 Item: 1 [Success]
    State 4 Twain Triplet: Control, Capability, Set - Capability: Indicators, Container: One - OneValue: ItemType: Bool Item: 1 [Success]
    State 4 Twain Triplet: Control, UserInterface, EnableDS -
     Twain User Interface:
      ShowUI:          0
      ModalUI:         1
      ParentHand:      4064444
     [Success]
    State 5 Twain Triplet: Control, Event, ProcessEvent - Twain Event (XFerReady) [DataSourceEvent]
    State 6 Twain Triplet: Image, ImageInfo, Get -
     ImageInfo:
      XResolution:     200
      YResolution:     200
      ImageWidth:      1700
      ImageLength:     2800
      SamplesPerPixel: 1
      BitsPerSample:   8 0 0 0 0 0 0 0
      BitsPerPixel:    8
      Planar:          0
      PixelType:       1
      Compression:     0
     [Success]
    State 7 Twain Triplet: Image, ImageNativeXfer, Get - 79626508 [TransferDone]
    State 7 Twain Triplet: Control, PendingXfers, EndXfer - PendingTransfers (count 0, End 0) [Success]
    State 6 Implied, Pending Transfer Count of 0
    State 5 Twain Triplet: Control, Event, ProcessEvent - Twain Event (CloseDSReq) [DataSourceEvent]
    State 5 Twain Triplet: Control, Event, ProcessEvent - Twain Event (Null) [NotDataSourceEvent]
    State 5 Twain Triplet: Control, UserInterface, DisableDS -
     Twain User Interface:
      ShowUI:          0
      ModalUI:         1
      ParentHand:      4064444
     [Success]
    State 4 Twain Triplet: Control, Identity, CloseDS -
     Identity Structure:
      Id:              1018
      Version:         1.0
      Language:        UsEnglish
      Country:         Usa
      Info:            December, 2001
      Protocol:   1.9
      SupportedGroups: 3
      Manufacturer:    Hewlett-Packard
      ProductFamily:   All-in-One
      ProductName:     Officejet Pro L7600 TWAIN
     [Success]
    State 3 Twain Triplet: Control, Identity, OpenDS -
     Identity Structure:
      Id:              1018
      Version:         1.0
      Language:        UsEnglish
      Country:         Usa
      Info:            December, 2001
      Protocol:   1.9
      SupportedGroups: 3
      Manufacturer:    Hewlett-Packard
      ProductFamily:   All-in-One
      ProductName:     Officejet Pro L7600 TWAIN
     [Success]
    State 4 Twain Triplet: Control, Identity, CloseDS -
     Identity Structure:
      Id:              1018
      Version:         1.0
      Language:        UsEnglish
      Country:         Usa
      Info:            December, 2001
      Protocol:   1.9
      SupportedGroups: 3
      Manufacturer:    Hewlett-Packard
      ProductFamily:   All-in-One
      ProductName:     Officejet Pro L7600 TWAIN
     [Success]

  • 06-24-2008 2:20 PM In reply to

    Re: Imageman.net TWAIN - Setting TWAIN properties

    Hi Mike,

    I am no expert on this but thought I would pass this along.  I have tried the twain control on a Canoscan 4400, a Fujitsu 4120C, and a BizCardReader 600C and have not had any problem with the  PageScanned, ScanCancelled, or ScanComplete events when using the ScanAll method.  They all seem to work fine for me.  I have not tried any HP scanners.  Are you using the ScanPage or ScanAll method?  The CloseSource only seems to be needed when you use the ScanPage. 

    Tony 

  • 06-24-2008 4:26 PM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Imageman.net TWAIN - Setting TWAIN properties

    Thank you for some additional information. I am far from being and expert also.

    I have tried both the ScanPage and ScanAll, today with with the ADF on the HP L7650.

    When using the ADF I got PageScanned Event, between each page, then again got a scan cancelled after the last page.

    Never did get a scancomplete.

    If I am not doing something wrong, perhaps something weird is going on with these All-in-one, scanner printer devices.

    Perhaps a dedicated scanner would work better,  to bad I do not have one on hand to try.

  • 06-24-2008 4:37 PM In reply to

    Re: Imageman.net TWAIN - Setting TWAIN properties

     Hi Mike,

    Is this with one of our sample apps or your own code ? If its your own code does it occur with the sample apps ? 

    Sean
    Data Techniques Online Support
  • 06-25-2008 7:54 AM In reply to

    • MikeS
    • Top 25 Contributor
    • Joined on 07-20-2007
    • Posts 39

    Re: Imageman.net TWAIN - Setting TWAIN properties

    support:

    Is this with one of our sample apps or your own code ? If its your own code does it occur with the sample apps ? 

    Hi Sean,

    As mentioned in my second post, none of the VB2005 samples use events of any kind.

    Only the VB2003 vbDEMO sample uses events and it makes use of a 'CheckForAndReportLasError' sub.

    Unfortunately the scan cancelled event returns Success or Okay so the CheckForAndReportLastError ignore it.

    I have taken the VB2003 demo, and allowed it to be updated to VB2005, then added message boxes on the events and yes I am getting ScanCancelled after every page.

    On an additional note to confuse stuff more, I have been jumping between different scanners and code trying to get stuff to work, so keeping results straight has been tough. Anyway I thought I noticed last night that I was mistaken on the Cancel Button on the HP Scanner. 

    Testing this morning  with the converted VB2003 demo, I confirmed that I am not gettting any event when the user clicks on the 'indicator' progress cancel button on the HP Scanner.  However I do get an event with the Lexmark, but again the last error results are success/okay.

    So to answer your question, I see (I think) the same results with my code or with the Converted (but slightly modified) VB2003 vbDemo Sample Code.

    As I do not think I am doing anything out of the ordinary, and events are working fine for others, I am left to assume the problem is with the two scanners that  I have. 

    Therefore, I am not asking for time to be spent to attempt to replicate what I am seeing. Unless, of course, you really want to.

    Thanks,

    Mike

    p.s.
    Though I had hoped to stay with Data Techniques for this SDK, as I am quite pleased with the FAXMAN SDK, I have started looking at other (unfortunately more expensive) solutions to see if they work any better with my scanners.  Maybe I will just find I need a different scanner.

     

  • 06-25-2008 11:56 AM In reply to

    • ejw
    • Top 200 Contributor
    • Joined on 03-13-2007
    • Posts 6

    Re: Imageman.net TWAIN - Setting TWAIN properties

    Dear Mike,

    Thank you for the log file and background information.

     You are not the only user to have run into this.

    To resolve this issue we have had to extend our interface. 

    The ScanCancel was fired by some devices even with a successful scan.
    The ScanCloseRequest event has been added to help with this issue. Even with the ScanCloseRequest event there is still some  ambiguity as it will vary from device to device.
    On all devices it will fire when a user presses a close button on a scan dialog.
    Unfortunately with some devices it will also fire at the end of a successful
    scan or if there are no more pages to scan in the ADF.

    To use the extended interface please download 2.60.

     

     

     

Page 1 of 1 (8 items)
Copyright 2009 Data Techniques, Inc. All Rights Reserved.