为什么在协商 Twain 会话时设置 PixelType 不起作用?
我正在尝试以编程方式指定 TWAIN 会话中的扫描设置。因为这里的代码量很大,所以我将尝试在不粘贴整个代码的情况下解释问题。我希望有人擅长 TWAIN 来帮助我......
为了进行扫描设置,我使用对本机 Twain 库的低级调用。扫描仪是HP Scanjet 7000。目前我一直在设置颜色和位深度选项。重要的是我在使用其他两台扫描仪时没有遇到任何问题。只是这个模型。
根据设置ICAP_BITDEPTH(第480页)之前的规范,我需要设置ICAP_PIXELTYPE(535)。所以首先我要求提供支持的 PixelTypes 列表...它们是 TWPT_BW(黑白)、TWPT_GRAY(灰色)和 TWPT_RGB(RGB)。因为我想要获得黑白扫描,所以我尝试将此功能设置为 TWPT_BW。这会导致错误,我不明白为什么。正如我在另外两个模型中所说的,这是有效的。
该扫描仪是否可能不允许这样的设置功能?
I'm trying to specify programmatically settings for scanning in TWAIN session. Because amount of code here would be significant I'm going to try to explain the problem without pasting the entire code. I hope there's someone good at TWAIN to help me....
To do scanning settings I'm using lowlevel calls to native Twain library. The scanner is HP Scanjet 7000. At the moment I'm stuck with setting colour and bit depth options. What is important I haven't had any problems with two other scanners. just this model.
According to the specification before setting ICAP_BITDEPTH (page 480) I need to set ICAP_PIXELTYPE (535). So first I'm asking for the list of supported PixelTypes... And they are TWPT_BW (Black&White), TWPT_GRAY (Gray) and TWPT_RGB (RGB). Since I want to get black&white scans I'm trying to set this capabilityt to TWPT_BW. This results in an error and I don't understand why. As I said in two other models this is working.
Is it possible that this scanner disallows setting capabilities like this?
TWAIN Specification:
http://www.twain.org/docs/TWAIN_2_1_Spec.pdf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个问题原来是一个规格问题。看来 hp scanjet 扫描仪在设置 PixelType 时需要 TwainType.UInt16,而我将 TwainType.Int16 设置为第一个参数。感谢用户 AlexKak 我找到了这个问题的答案。
http://www.codeproject.com/KB/dotnet/twaindotnet .aspx?msg=1313293#xx1313293xx
This problem turned out to be a specification issue. It appears that hp scanjet scanners when setting PixelType they require TwainType.UInt16 and I was setting TwainType.Int16 as the first parameter. Thank you to user AlexKak I found the answer to this problem.
http://www.codeproject.com/KB/dotnet/twaindotnet.aspx?msg=1313293#xx1313293xx