I am very new to Qt and right now we are developing an application that is using the TWAIN library to control a scanner.
By default, we assumed that the DPI setting of the scanner is set to 300. However, if by chance, the user manually sets the scanner's DPI to 600 in the device settings, our application has to adjust accordingly.
Is there any way to know the DPI setting of the scanner internally through TWAIN? Like know what DPI setting is currently chosen.
Okay. I figured it out. It turns out that pTW_ENUMERATION has an attribute named CurrentIndex which stores the index of the chosen DPI. So from the code from How do I enumerate resolutions supported via TWAIN
TW_CAPABILITY twCap;
GetCapability(twCap, ICAP_XRESOLUTION);
TW_UINT32 res = 0;
if (twCap.ConType == TWON_ENUMERATION) {
pTW_ENUMERATION en = (pTW_ENUMERATION) GlobalLock(twCap.hContainer);
if (en->ItemType == TWTY_FIX32) {
res = ((TW_UINT32*)(en->ItemList))[en->CurrentIndex];
qDebug()<<res;
}
}