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

getting TW_EXTIMAGEINFO

Forums › TWAIN Classic › getting TW_EXTIMAGEINFO

  • This topic has 17 replies, 3 voices, and was last updated 1 month ago by Boscoash.
Viewing 15 posts - 1 through 15 (of 18 total)
1 2 →
  • Author
    Posts
  • February 14, 2008 at 6:33 pm #22289 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    Hi all,
    i’m trying to get some informations (eg. barcode) from scanned page. I’ve downloaded a NETMasters code example, implemented two structures –


    [StructLayout(LayoutKind.Sequential, Pack = 2)]
    internal struct TwInfo
    {
    public short InfoID;
    public short ItemType;
    public short NumItems;
    public short CondCode;
    public int Item;
    }

    [StructLayout(LayoutKind.Sequential, Pack = 2)]
    internal class TwExtImageInfo
    {
    public int NumInfos;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
    public TwInfo Info;
    }

    , enum


    internal enum TwEImgInf: short {
    ...
    formvertdocoffset = 0x1218,
    barcodecount = 0x1219,
    barcodeconfidence = 0x121a,
    ...
    }

    and function


    [DllImport("twain_32.dll", EntryPoint = "#1")]
    private static extern TwRC DSextImgInfo([In, Out] TwIdentity origin, [In, Out] TwIdentity dest, TwDG dg, TwDAT dat, TwMSG msg, TwExtImageInfo extimginf );

    according to specification, i’m trying to get information right after i recieve XFERDONE. My code is :


    TwExtImageInfo extinf = new TwExtImageInfo();
    extinf.NumInfos = 1;
    extinf.Info.CondCode = 0;
    extinf.Info.InfoID = (short)TwEImgInf.barcodecount;
    extinf.Info.ItemType = (short)TwType.Int32;
    extinf.Info.NumItems = 0;
    extinf.Info.CondCode = 0;
    rc = DSextImgInfo(appid, srcds, TwDG.Image, TwDAT.ExtImageInfo, wMSG.Get, extinf);

    i’m allways get error “cannot marshal field Info of type TwExtImageInfo”. can anyone help me with this? i’m nearly mad… 🙁

    February 15, 2008 at 11:31 pm #24351 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    i took a somewhat different approach, i asked for every standard extInfo (not just the barcode info) but if you want to translate the classes from vb.net the code is over at http://www.codeplex.com/opentwain. if you run the sample app the extInfo will output in your ide.

    .

    February 19, 2008 at 1:55 pm #24352 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    thanks gabe, i will take a look to opentwain.
    i’ve got one more question about capabilities… application supplied with my scanner (HP Scanjet N7710) can read barcodes. When i read supported capabilities there is no one ICAP_BARCODE*, but when i get CustomData i have found this line –
    “BarType=0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0:BarAutoReadFront=1:BarAutoReadBack=1:BarcodeEnabled=1:BarcodeParameters=”.
    So, support this scanner barcode detection or not? Reading TWEI_BARCODECOUNT always returns 0… 🙁
    Is there a possibility that supplied application use ISIS besides twain?

    February 19, 2008 at 2:21 pm #24353 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    what driver are you using? Ther is typically a driver on the cd that came with you hp scanner that has a name ‘hp commercial twain %model number%’

    check if you get barcode info out of the extInfo with the commercial driver, and you may have to look into their custom extInfo, I’ll often go looking for another 100 or 2 over the standard set of id for extra/undocumented info

    .

    February 19, 2008 at 3:11 pm #24354 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    i’m using driver supplied with scanner, these two files :
    hp7710co.dll – Hewlett Packard ScanJet VendorSetup Extension Dynamic Link Library
    hpgt7710.dll – Hewlett Packard ScanJet N7710 series common scanner interface library
    Do you think that the problem is in these drivers? I tryied to found another on the HP web site, but it seems that this is the only one which they have 🙁

    February 19, 2008 at 3:13 pm #24355 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    the scanner came with a cd. search the cd for a directory that contains the word ‘commercial’
    You’ll like that driver much much more (at least I typically do)

    I’ve tried finding those drivers online but I seldom have much success,.. though that could just be my poor internet searching skills… hard to say.

    .

    February 19, 2008 at 3:46 pm #24356 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    i’ve found nothing 🙁 it seems like there is no other driver. grr. i will try some hp forum and we’ll see… thaks for help

    February 19, 2008 at 3:51 pm #24357 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    on the other hand, i seem to remember that the toolkit would display all sorts of info if you set the logging to full…

    if run twack_32 and set the message level to full and acquire do you see any mention of a barcode in the dialogs (assuming you are scanning something with a barcode)?

    .

    February 20, 2008 at 11:34 am #24358 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    twack, when set messagelevel:full, tells me only informations about tw_imageinfo and tw_imagelayout 🙁

    February 20, 2008 at 11:49 am #24359 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    do you see CAP_ENABLEDSUIONLY under supportedCaps?

    February 20, 2008 at 11:54 am #24360 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    jop, and it’s set to true by default

    February 20, 2008 at 12:38 pm #24361 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    is a read only Cap, it just indicates that the device supports the capability (you can’t set it)

    then my last idea for getting extInfo out of the device is to run the device from opentwain. If you start the guiharness project form opentwain with your debugger, you should see a whole bunch of stuff scroll thru your output window (vs 2005) some of the stuff that scrolls by will be all of the extInfo.

    …and if i misremember the current build I posted and if i happened to have commented out the method that outputs all the extInfo lemme know and I’ll tell you where/how do re-enable the output.

    .

    February 20, 2008 at 2:03 pm #24362 Reply
    zelvak
    Participant
    • Topics - 1
    • Replies - 7
    • Total Posts - 8

    So, i send trace info into the text file, and this is result for extimageinfo :


    Standard ExtImageInfo Start
    1200 4608 BarCodeX 0 UInt32 5 Success
    1201 4609 BarCodeY 0 UInt32 5 Success
    1202 4610 BarCodeText Str255 12 Success
    1203 4611 BarCodeType 4294967295 UInt32 5 Success
    ...
    1219 4633 BarCodeCount 0 Int32 2 Success
    121A 4634 BarCodeConfidence 0 Int32 2 Success
    121B 4635 BarCodeRotation 0 UInt32 5 Success
    121C 4636 BarCodeTextLength 0 UInt32 5 Success
    Standard ExtImageInfo Finished

    strange is, that opentwain crash after acquiring image on HP N7710 (Epson RX585 and HP 4500C are ok). Problem was in twCapability.vb / m_ReadStr255 – when trying to read bytes from pointer returned by ACAP_XFERMECH, TWEI_BOOKNAME and TWEI_CAMERA. Try and catch on


    byt = Runtime.InteropServices.Marshal.ReadByte(fixPtr, Position)

    solved this, but i dont know where is the problem…

    February 20, 2008 at 2:46 pm #24363 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    was it an AccessViolationException? and was it due to the ptr being null or 0?

    I’ll look back thru the code, and one more thing – you are feeding a document that contains a valid barcode right?

    .

    February 20, 2008 at 2:50 pm #24364 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    did m_ReadStr255 loop thru at all before it threw or was it the first pass thru that went kaboom? wondering if they put any text in there at all or not,..

    .

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 18 total)
1 2 →
Reply To: Reply #24354 in getting TW_EXTIMAGEINFO
Your information:




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

  • Scanner starts transfer when console gets closed (CITRIX)
  • Kodak RFS 3600
  • Didn’t save enough file scan
  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • 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

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.