Author |
Topic |
|
nachbar
USA
17 Posts |
Posted - Oct 18 2023 : 19:49:05
|
Hello. I am trying to understand how to use SourceSettings to preserve the scan settings over different runs of my executable.
I am using Fugitsu fi-7460 and fi-7160 scanners.
I am able to use the TwainStore demo to select the scanner configuration (e.g., RGB or Text), and to restore that using SourceSettings.LoadFromFile
The configuration that changes includes the PixelType (RGB or Black and White). However, PixelType.CurrentValue does not seem to change, even when LoadFromFile changes the PixelType from the previously-set (in the scanner) PixelType.
Also, setting PixelType and X and Y Resolution and trying to save the SourceSettings returns an empty stream. The only way I can get SourceSettings to have content appears to be to set ShowSettingsOnly and then call Acquire, as in the demo.
How should SourceSettings interact with PixelType and X and Y resolution? Is that how this is supposed to work? Is there a way to save the scanner settings, including PixelType and resolution, using SourceSettings without showing the scanner dialog? And is there a way to find out if the scanner is scanning in color or black and white when SourceSettings has been used to save and then set the configuration?
Finally, is there a preferred way to save all of the current scanner configuration, including PixelType and resolution set via the API?
Thank you.
Jim Nachbar
James Nachbar |
|
xequte
38610 Posts |
|
nachbar
USA
17 Posts |
Posted - Oct 19 2023 : 22:41:50
|
Thank you. I did some additional testing, and for the benefit of anyone finding this thread in the future (including my future self):
With both my Fujitsu fi-7460 and fi-7160, SourceSettings works to set e.g. PixelType and resolution as used by the scanner, but it does NOT actually change PixelType or XResolution as read via the API, so there is no way to actually determine what the current PixelType or XResolution are if they have been set by SourceSettings
For the both fi-7460 and fi-7160, AcquireSettings works the same as TwainSettings, and the values retrieved via the API do not reflect the PixelType or XResolution when those have been set by SourceSettings.
Further, for both fi-7460 and fi-7160, if you then manually change PixelType, then PixelType as read out via the API as how you set it, and the manually-set PixelType is also how the scanner captures.
BUT, if, after setting PixelType manually, you then try to use SourceSettings for a different setting, SourceSettings no longer works to change PixelType as used by the scanner for scans. In other words, once you manually set PixelType, then the manually set PixelType is what is seen in the API and also how the scanner scans, and you can no longer change PixelType with SourceSettings once you have manually set PixelType.
Restarting the application restores the ability to use SourceSettings again. I do not know if there might be another way to restore that ability short of restarting the application.
Jim Nachbar
James Nachbar |
|
|
xequte
38610 Posts |
Posted - Oct 20 2023 : 02:16:22
|
Thanks for the update, Jim,
Did you try calling ImageEnView1.IO.TwainParams.SetDefaultParams() before reloading the source settings?
Nigel Xequte Software www.imageen.com
|
|
|
nachbar
USA
17 Posts |
Posted - Oct 20 2023 : 08:02:31
|
>> Did you try calling ImageEnView1.IO.TwainParams.SetDefaultParams() before reloading the source settings?
No, I had not, but that seems to be the missing factor.
After calling .SetDefaultParams(), not only does loading SourceSettings work again, but it also allows reading PixelType and XResolution to work properly, letting me see via the API what PixelType and XResolution will be used by the scanner to scan.
As expected, calling .SetDefaultParams() does reset VisibleDialog, so you need to be sure to make all your changes to any settings after you call .SetDefaultParams().
Thanks so much for helping me resolve this, and thanks again for all your work on ImageEn! It is an incredibly useful tool, of very high quality.
Jim Nachbar |
|
|
xequte
38610 Posts |
Posted - Oct 20 2023 : 20:08:52
|
Thanks Jim
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|
|
|