Try to put KDS values in own namespace and enum.

This commit is contained in:
Eugene Wang 2025-03-09 08:55:45 -04:00
parent 5c15ec3711
commit c8ee66a828
17 changed files with 5569 additions and 87 deletions

View File

@ -31,6 +31,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "csizes", "csizes\csizes.vcx
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WinConsole32", "samples\WinConsole32\WinConsole32.csproj", "{4E2417E7-FDC3-46D7-B976-84A97B500B74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScannerTester", "samples\ScannerTester\ScannerTester.csproj", "{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -123,6 +125,22 @@ Global
{4E2417E7-FDC3-46D7-B976-84A97B500B74}.Release|x64.Build.0 = Release|Any CPU
{4E2417E7-FDC3-46D7-B976-84A97B500B74}.Release|x86.ActiveCfg = Release|Any CPU
{4E2417E7-FDC3-46D7-B976-84A97B500B74}.Release|x86.Build.0 = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|ARM64.Build.0 = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|x64.ActiveCfg = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|x64.Build.0 = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|x86.ActiveCfg = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Debug|x86.Build.0 = Debug|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|Any CPU.Build.0 = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|ARM64.ActiveCfg = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|ARM64.Build.0 = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|x64.ActiveCfg = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|x64.Build.0 = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|x86.ActiveCfg = Release|Any CPU
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -131,6 +149,7 @@ Global
{7792A94E-D0B4-440D-8BD5-CA1CA548782C} = {707B4313-8EF8-4D0F-A95E-590783422187}
{C9666CB2-C9A6-48C8-AB51-D616A48058A7} = {707B4313-8EF8-4D0F-A95E-590783422187}
{4E2417E7-FDC3-46D7-B976-84A97B500B74} = {707B4313-8EF8-4D0F-A95E-590783422187}
{EEFDA89D-7E11-7609-5383-FA1ADEA88CF4} = {707B4313-8EF8-4D0F-A95E-590783422187}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7459323B-44F6-4E07-8574-E1B4B525086B}

341
samples/ScannerTester/MainForm.Designer.cs generated Normal file
View File

@ -0,0 +1,341 @@
namespace ScannerTester
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
label1 = new Label();
btnSelectScanner = new Button();
groupSettings = new GroupBox();
listFormat = new ComboBox();
label7 = new Label();
boxNamePrefix = new TextBox();
label6 = new Label();
btnOpenFolder = new Button();
btnBrowseFolder = new Button();
boxFolder = new TextBox();
label5 = new Label();
boxLimit = new NumericUpDown();
label4 = new Label();
listDpi = new ComboBox();
label3 = new Label();
lblCurScanner = new Label();
groupTest = new GroupBox();
boxLog = new RichTextBox();
label2 = new Label();
ckShowUI = new CheckBox();
btnStop = new Button();
btnTransfer = new Button();
btnDriverOnly = new Button();
groupSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)boxLimit).BeginInit();
groupTest.SuspendLayout();
SuspendLayout();
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 9);
label1.Name = "label1";
label1.Size = new Size(612, 25);
label1.TabIndex = 0;
label1.Text = "Use this tool to see if the scanner can be used with the ScanCloud Scan App";
//
// btnSelectScanner
//
btnSelectScanner.Location = new Point(12, 46);
btnSelectScanner.Name = "btnSelectScanner";
btnSelectScanner.Size = new Size(238, 34);
btnSelectScanner.TabIndex = 1;
btnSelectScanner.Text = "Choose Scanner...";
btnSelectScanner.UseVisualStyleBackColor = true;
btnSelectScanner.Click += btnSelectScanner_Click;
//
// groupSettings
//
groupSettings.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
groupSettings.Controls.Add(listFormat);
groupSettings.Controls.Add(label7);
groupSettings.Controls.Add(boxNamePrefix);
groupSettings.Controls.Add(label6);
groupSettings.Controls.Add(btnOpenFolder);
groupSettings.Controls.Add(btnBrowseFolder);
groupSettings.Controls.Add(boxFolder);
groupSettings.Controls.Add(label5);
groupSettings.Controls.Add(boxLimit);
groupSettings.Controls.Add(label4);
groupSettings.Controls.Add(listDpi);
groupSettings.Controls.Add(label3);
groupSettings.Location = new Point(12, 99);
groupSettings.Name = "groupSettings";
groupSettings.Size = new Size(742, 932);
groupSettings.TabIndex = 2;
groupSettings.TabStop = false;
groupSettings.Text = "Settings";
//
// listFormat
//
listFormat.DropDownStyle = ComboBoxStyle.DropDownList;
listFormat.FormattingEnabled = true;
listFormat.Location = new Point(157, 243);
listFormat.Name = "listFormat";
listFormat.Size = new Size(182, 33);
listFormat.TabIndex = 10;
//
// label7
//
label7.AutoSize = true;
label7.Location = new Point(47, 246);
label7.Name = "label7";
label7.Size = new Size(100, 25);
label7.TabIndex = 9;
label7.Text = "File Format";
//
// boxNamePrefix
//
boxNamePrefix.Location = new Point(157, 207);
boxNamePrefix.Name = "boxNamePrefix";
boxNamePrefix.Size = new Size(182, 31);
boxNamePrefix.TabIndex = 8;
boxNamePrefix.Text = "Capture_";
//
// label6
//
label6.AutoSize = true;
label6.Location = new Point(13, 210);
label6.Name = "label6";
label6.Size = new Size(138, 25);
label6.TabIndex = 7;
label6.Text = "File Name Prefix";
//
// btnOpenFolder
//
btnOpenFolder.Location = new Point(275, 167);
btnOpenFolder.Name = "btnOpenFolder";
btnOpenFolder.Size = new Size(112, 34);
btnOpenFolder.TabIndex = 6;
btnOpenFolder.Text = "Open";
btnOpenFolder.UseVisualStyleBackColor = true;
btnOpenFolder.Click += btnOpenFolder_Click;
//
// btnBrowseFolder
//
btnBrowseFolder.Location = new Point(157, 167);
btnBrowseFolder.Name = "btnBrowseFolder";
btnBrowseFolder.Size = new Size(112, 34);
btnBrowseFolder.TabIndex = 6;
btnBrowseFolder.Text = "Browse...";
btnBrowseFolder.UseVisualStyleBackColor = true;
btnBrowseFolder.Click += btnBrowseFolder_Click;
//
// boxFolder
//
boxFolder.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
boxFolder.Location = new Point(157, 130);
boxFolder.Name = "boxFolder";
boxFolder.Size = new Size(556, 31);
boxFolder.TabIndex = 5;
boxFolder.Text = "Images";
//
// label5
//
label5.AutoSize = true;
label5.Location = new Point(47, 133);
label5.Name = "label5";
label5.Size = new Size(104, 25);
label5.TabIndex = 4;
label5.Text = "Save Folder";
//
// boxLimit
//
boxLimit.Location = new Point(157, 93);
boxLimit.Minimum = new decimal(new int[] { 1, 0, 0, int.MinValue });
boxLimit.Name = "boxLimit";
boxLimit.Size = new Size(182, 31);
boxLimit.TabIndex = 3;
boxLimit.Value = new decimal(new int[] { 1, 0, 0, int.MinValue });
//
// label4
//
label4.AutoSize = true;
label4.Location = new Point(35, 95);
label4.Name = "label4";
label4.Size = new Size(116, 25);
label4.TabIndex = 2;
label4.Text = "Transfer Limit";
//
// listDpi
//
listDpi.DropDownStyle = ComboBoxStyle.DropDownList;
listDpi.FormattingEnabled = true;
listDpi.Location = new Point(157, 54);
listDpi.Name = "listDpi";
listDpi.Size = new Size(182, 33);
listDpi.TabIndex = 1;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(111, 57);
label3.Name = "label3";
label3.Size = new Size(40, 25);
label3.TabIndex = 0;
label3.Text = "DPI";
//
// lblCurScanner
//
lblCurScanner.AutoSize = true;
lblCurScanner.Location = new Point(256, 51);
lblCurScanner.Name = "lblCurScanner";
lblCurScanner.Size = new Size(124, 25);
lblCurScanner.TabIndex = 3;
lblCurScanner.Text = "None selected";
//
// groupTest
//
groupTest.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
groupTest.Controls.Add(boxLog);
groupTest.Controls.Add(label2);
groupTest.Controls.Add(ckShowUI);
groupTest.Controls.Add(btnStop);
groupTest.Controls.Add(btnTransfer);
groupTest.Controls.Add(btnDriverOnly);
groupTest.Location = new Point(760, 99);
groupTest.Name = "groupTest";
groupTest.Size = new Size(1038, 932);
groupTest.TabIndex = 4;
groupTest.TabStop = false;
groupTest.Text = "Test";
//
// boxLog
//
boxLog.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
boxLog.Location = new Point(22, 118);
boxLog.Name = "boxLog";
boxLog.Size = new Size(999, 796);
boxLog.TabIndex = 4;
boxLog.Text = "";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(22, 90);
label2.Name = "label2";
label2.Size = new Size(50, 25);
label2.TabIndex = 3;
label2.Text = "Logs";
//
// ckShowUI
//
ckShowUI.AutoSize = true;
ckShowUI.Location = new Point(451, 43);
ckShowUI.Name = "ckShowUI";
ckShowUI.Size = new Size(253, 29);
ckShowUI.TabIndex = 2;
ckShowUI.Text = "Show driver during capture";
ckShowUI.UseVisualStyleBackColor = true;
//
// btnStop
//
btnStop.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnStop.Location = new Point(897, 39);
btnStop.Name = "btnStop";
btnStop.Size = new Size(124, 34);
btnStop.TabIndex = 2;
btnStop.Text = "Stop";
btnStop.UseVisualStyleBackColor = true;
btnStop.Click += btnStop_Click;
//
// btnTransfer
//
btnTransfer.Location = new Point(239, 39);
btnTransfer.Name = "btnTransfer";
btnTransfer.Size = new Size(206, 34);
btnTransfer.TabIndex = 1;
btnTransfer.Text = "Start Capture";
btnTransfer.UseVisualStyleBackColor = true;
btnTransfer.Click += btnTransfer_Click;
//
// btnDriverOnly
//
btnDriverOnly.Location = new Point(22, 39);
btnDriverOnly.Name = "btnDriverOnly";
btnDriverOnly.Size = new Size(206, 34);
btnDriverOnly.TabIndex = 0;
btnDriverOnly.Text = "Open Driver UI";
btnDriverOnly.UseVisualStyleBackColor = true;
btnDriverOnly.Click += btnDriverOnly_Click;
//
// MainForm
//
AutoScaleDimensions = new SizeF(10F, 25F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1810, 1043);
Controls.Add(groupTest);
Controls.Add(lblCurScanner);
Controls.Add(groupSettings);
Controls.Add(btnSelectScanner);
Controls.Add(label1);
Name = "MainForm";
SizeGripStyle = SizeGripStyle.Show;
Text = "Scanner Tester Utility";
groupSettings.ResumeLayout(false);
groupSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)boxLimit).EndInit();
groupTest.ResumeLayout(false);
groupTest.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Label label1;
private Button btnSelectScanner;
private GroupBox groupSettings;
private Label lblCurScanner;
private GroupBox groupTest;
private CheckBox ckShowUI;
private Button btnTransfer;
private Button btnDriverOnly;
private RichTextBox boxLog;
private Label label2;
private Button btnStop;
private ComboBox listDpi;
private Label label3;
private Label label4;
private NumericUpDown boxLimit;
private Label label5;
private Button btnOpenFolder;
private Button btnBrowseFolder;
private TextBox boxFolder;
private TextBox boxNamePrefix;
private Label label6;
private ComboBox listFormat;
private Label label7;
}
}

View File

@ -0,0 +1,591 @@
using NTwain;
using NTwain.Data;
using NTwain.Data.KDS;
using NTwain.Triplets;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
namespace ScannerTester
{
public partial class MainForm : Form
{
TwainAppSession _twain;
private bool _stopTransfer;
public MainForm()
{
InitializeComponent();
_twain = new TwainAppSession();
_twain.TransferReady += _twain_TransferReady;
_twain.Transferred += _twain_Transferred;
_twain.SourceDisabled += _twain_SourceDisabled;
_twain.AddWinformFilter();
}
private void _twain_SourceDisabled(TwainAppSession sender, TW_IDENTITY_LEGACY e)
{
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_twain.OpenDSM(Handle, SynchronizationContext.Current!);
//_ = _twain.OpenDSMAsync();
}
protected override void OnClosed(EventArgs e)
{
_twain.CloseDSM();
//_ = _twain.CloseDSMAsync();
base.OnClosed(e);
}
private void _twain_Transferred(TwainAppSession sender, TransferredEventArgs e)
{
Invoke(() =>
{
TW_EXTIMAGEINFO extInfo = TW_EXTIMAGEINFO.CreateRequest(TWEI.CAMERA);
e.GetExtendedImageInfo(ref extInfo);
string? camera = null;
foreach (var ei in extInfo.AsInfos())
{
if (ei.ReturnCode == TWRC.SUCCESS)
{
switch (ei.InfoId)
{
//case (TWEI)KDS_TWEI.HDR_PAGENUMBER:
// LogIt($"TWEI_HDR_PAGENUMBER Value = {ei.ReadNonPointerData<int>()}");
// break;
case TWEI.CAMERA:
camera = ei.ReadHandleString(_twain);
LogIt($"{ei.InfoId} Value = {camera}");
break;
}
}
else
{
LogIt($"{ei.InfoId} RC = {ei.ReturnCode}");
}
}
extInfo.Free(_twain);
if (e.Data != null)
{
LogIt($"Received {e.ImageInfo.PixelType} in {e.ImageInfo.Compression} compressed memory image.");
var folder = boxFolder.Text;
if (string.IsNullOrWhiteSpace(folder))
{
folder = "Images";
Directory.CreateDirectory(folder);
boxFolder.Text = folder;
}
var prefix = boxNamePrefix.Text;
if (string.IsNullOrWhiteSpace(prefix))
{
prefix = "Capture_";
boxNamePrefix.Text = prefix;
}
using (var img = System.Drawing.Image.FromStream(e.Data.AsStream()))
{
//var saveFile = img.SaveToSmallestFormat(folder, prefix, lossless: false).ToString();
//LogIt($"File saved to {saveFile}");
}
}
else if (e.FileInfo != null)
{
var info = e.FileInfo.Value;
var path = info.FileName.ToString();
LogIt($"Received {e.ImageInfo.PixelType} {info.Format} in {e.ImageInfo.Compression} compressed file {path}");
}
e.Dispose();
LogIt("");
});
}
int _xferCount = 0;
private void _twain_TransferReady(TwainAppSession sender, TransferReadyEventArgs e)
{
Invoke(() =>
{
if (_stopTransfer)
{
e.Cancel = CancelType.EndNow;
return;
}
_xferCount++;
LogIt($"Got pending transfer with mode = {e.ImgXferMech}");
if (e.ImgXferMech == TWSX.FILE)
{
var folder = boxFolder.Text;
if (string.IsNullOrWhiteSpace(folder))
{
folder = "Images";
Directory.CreateDirectory(folder);
boxFolder.Text = folder;
}
var prefix = boxNamePrefix.Text;
if (string.IsNullOrWhiteSpace(prefix))
{
prefix = "Capture_";
boxNamePrefix.Text = prefix;
}
TWCP comp = TWCP.NONE;
TW_EXTIMAGEINFO extInfo = TW_EXTIMAGEINFO.CreateRequest((TWEI)KDS_TWEI.HDR_COMPRESSION);
e.GetExtendedImageInfo(ref extInfo);
foreach (var ei in extInfo.AsInfos())
{
if (ei.ReturnCode == TWRC.SUCCESS)
{
switch (ei.InfoId)
{
case (TWEI)KDS_TWEI.HDR_COMPRESSION:
comp = ei.ReadNonPointerData<TWCP>();
LogIt($"{ei.InfoId} Value = {comp}");
break;
}
}
else
{
LogIt($"{ei.InfoId} RC = {ei.ReturnCode}");
}
}
extInfo.Free(_twain);
LogIt($"Compression at ready step = {comp}");
string? targetName = $"{prefix}_{_xferCount:D4}";
TWFF format = TWFF.TIFF;
switch (comp)
{
case TWCP.JPEG:
targetName = $"{prefix}_{_xferCount:D4}.jpg";
format = TWFF.JFIF;
break;
case TWCP.NONE:
targetName = $"{prefix}_{_xferCount:D4}.bmp";
format = TWFF.BMP;
break;
case TWCP.GROUP4:
default:
targetName = $"{prefix}_{_xferCount:D4}.tif";
break;
}
TW_SETUPFILEXFER setup = new()
{
FileName = Path.Combine(folder, targetName),
Format = format
};
var sts = e.SetupFileTransfer(ref setup);
LogIt($"Want to save image as {setup.Format} {setup.FileName}.", sts);
var appId = _twain.AppIdentity;
var srcId = _twain.CurrentSource;
sts = _twain.WrapInSTS(DGControl.SetupFileXfer.Get(ref appId, ref srcId, out setup));
LogIt($"Checked actual file settings as {setup.Format} {setup.FileName}.", sts);
}
LogIt("");
});
}
protected override void OnClosing(CancelEventArgs e)
{
if (_twain.State > STATE.S5)
{
e.Cancel = true;
}
_twain.TryStepdown(STATE.S2);
base.OnClosing(e);
}
private void btnSelectScanner_Click(object sender, EventArgs e)
{
var sts = _twain.ShowUserSelect();
if (sts.IsSuccess && _twain.DefaultSource.Id > 0)
{
if (_twain.State > STATE.S3)
{
_twain.TryStepdown(STATE.S3);
}
sts = _twain.OpenSource(_twain.DefaultSource);
LogIt("Open scanner", sts);
if (sts.IsSuccess)
{
var src = _twain.CurrentSource;
lblCurScanner.Text = $"{src.ProductName} | v{src.Version} | protocol: {src.ProtocolMajor}.{src.ProtocolMinor}";
LoadSettings();
return;
}
}
lblCurScanner.Text = "None selected";
}
private void LogIt(string msg)
{
boxLog.AppendText($"{msg}\n");
}
private void LogIt(string msg, STS sts)
{
if (sts.IsSuccess)
{
boxLog.AppendText($"{msg} result = {sts.RC}\n");
}
else
{
boxLog.AppendText($"{msg} result = {sts.RC} - {sts.ConditionCode}\n");
}
}
private void LoadSettings()
{
var mechs = _twain.Caps.ICAP_XFERMECH.Get();
if (!mechs.Contains(TWSX.FILE))
{
LogIt("File transfer is not supported.");
}
var sts = _twain.Caps.ICAP_XFERMECH.Set(TWSX.FILE);
LogIt("Use file transfer", sts);
if (_twain.Caps.ICAP_UNITS.GetCurrent().FirstOrDefault() != TWUN.INCHES)
{
sts = _twain.Caps.ICAP_UNITS.Set(TWUN.INCHES);
LogIt("Set unit to inches", sts);
}
var dpis = _twain.Caps.ICAP_XRESOLUTION.Get();
listDpi.Items.Clear();
if (dpis.Contains(200))
{
listDpi.Items.Add(200);
listDpi.SelectedItem = 200;
}
else
{
LogIt("200 DPI doesn't appear to be supported.");
}
if (dpis.Contains(300))
{
listDpi.Items.Add(300);
listDpi.SelectedItem = 300;
}
else
{
LogIt("300 DPI doesn't appear to be supported.");
}
var formats = _twain.Caps.ICAP_IMAGEFILEFORMAT.Get();
listFormat.Items.Clear();
foreach (var format in formats)
{
listFormat.Items.Add(format);
}
listFormat.SelectedItem = _twain.Caps.ICAP_IMAGEFILEFORMAT.GetCurrent().FirstOrDefault();
LogIt("");
}
private void btnDriverOnly_Click(object sender, EventArgs e)
{
if (_twain.State != STATE.S4) return;
var sts = _twain.EnableSource(true, true);
LogIt("Show drivers", sts);
LogIt("");
}
private void btnTransfer_Click(object sender, EventArgs e)
{
if (_twain.State != STATE.S4 || !EnsureBoxFolder()) return;
var _isIndustrialKodak = _twain.CurrentSource.ProductName.ToString().StartsWith("KODAK Scanner: i");
if (_isIndustrialKodak)
{
CaptureAsKodakSDMI();
}
else
{
CaptureAsStandardScanner();
}
_stopTransfer = false;
_xferCount = 0;
var sts = _twain.EnableSource(ckShowUI.Checked, false);
LogIt("Start capture", sts);
LogIt("");
}
private void CaptureAsKodakSDMI()
{
LogIt("Attempting Kodak SDMI mode");
LogIt($"Resolution supports {FlattenFlag(_twain.Caps.ICAP_XRESOLUTION.Supports)}");
LogIt($"File format supports {FlattenFlag(_twain.Caps.ICAP_IMAGEFILEFORMAT.Supports)}");
LogIt($"Compression supports {FlattenFlag(_twain.Caps.ICAP_COMPRESSION.Supports)}");
LogIt($"EXTINFO supports {FlattenFlag(_twain.Caps.ICAP_EXTIMAGEINFO.Supports)}");
LogIt("");
var limit = (short)boxLimit.Value;
if (limit > 0) limit *= 2;
var sts = _twain.Caps.CAP_XFERCOUNT.Set(limit);
LogIt($"Set transfer limit {limit}", sts);
sts = _twain.Caps.ICAP_EXTIMAGEINFO.Set(TW_BOOL.True);
LogIt($"Set extimageinfo enabled", sts);
var format = (TWFF)listFormat.SelectedItem!;
sts = _twain.Caps.ICAP_IMAGEFILEFORMAT.Set(format);
LogIt($"Set {format} format.", sts);
if (!sts.IsSuccess)
{
return;
}
LogIt("");
var appId = _twain.AppIdentity;
var srcId = _twain.CurrentSource;
TW_FILESYSTEM fs = new() { InputName = "/Camera_Bitonal_Both" };
sts = _twain.WrapInSTS(DGControl.FileSystem.ChangeDirectory(ref appId, ref srcId, ref fs));
LogIt("Change to bw cameras", sts);
if (sts.IsSuccess)
{
sts = _twain.Caps.CAP_CAMERAENABLED.Set(TW_BOOL.True);
LogIt("Set camera enabled", sts);
var dpi = listDpi.SelectedValue == null ? 300 : Convert.ToInt32(listDpi.SelectedValue);
sts = _twain.Caps.ICAP_XRESOLUTION.Set(dpi);
LogIt("Set x-resolution", sts);
sts = _twain.Caps.ICAP_YRESOLUTION.Set(dpi);
LogIt("Set y-resolution", sts);
if (format != TWFF.BMP)
{
LogIt($"Current format={_twain.Caps.ICAP_IMAGEFILEFORMAT.GetCurrent().First()}");
LogIt($"Current compression={_twain.Caps.ICAP_COMPRESSION.GetCurrent().First()}");
if (_twain.Caps.ICAP_COMPRESSION.Supports.HasFlag(TWQC.SET))
{
sts = _twain.Caps.ICAP_COMPRESSION.Set(TWCP.GROUP4);
LogIt("Set compression to group4", sts);
}
}
}
LogIt("");
fs = new() { FileType = (int)TWFY.CAMERA, InputName = "/Camera_Color_Both" }; sts = _twain.WrapInSTS(DGControl.FileSystem.ChangeDirectory(ref appId, ref srcId, ref fs));
LogIt("Change to color cameras", sts);
if (sts.IsSuccess)
{
sts = _twain.Caps.CAP_CAMERAENABLED.Set(TW_BOOL.True);
LogIt("Set camera enabled", sts);
var dpi = listDpi.SelectedValue == null ? 300 : Convert.ToInt32(listDpi.SelectedValue);
sts = _twain.Caps.ICAP_XRESOLUTION.Set(dpi);
LogIt("Set x-resolution", sts);
sts = _twain.Caps.ICAP_YRESOLUTION.Set(dpi);
LogIt("Set y-resolution", sts);
if (format != TWFF.BMP)
{
LogIt($"Current format={_twain.Caps.ICAP_IMAGEFILEFORMAT.GetCurrent().First()}");
LogIt($"Current compression={_twain.Caps.ICAP_COMPRESSION.GetCurrent().First()}");
if (_twain.Caps.ICAP_COMPRESSION.Supports.HasFlag(TWQC.SET))
{
sts = _twain.Caps.ICAP_COMPRESSION.Set(TWCP.JPEG);
LogIt("Set compression to jpg", sts);
if (sts.IsSuccess)
{
LogIt($"jpeg quality supports {FlattenFlag(_twain.Caps.ICAP_JPEGQUALITY.Supports)}");
short quality = 90;
sts = _twain.Caps.ICAP_JPEGQUALITY.Set((TWJQ)quality);
LogIt($"Set jpg quality to {quality}", sts);
if (!sts.IsSuccess)
{
quality = 85;
sts = _twain.Caps.ICAP_JPEGQUALITY.Set((TWJQ)quality);
LogIt($"Set jpg quality to {quality}", sts);
if (!sts.IsSuccess)
{
sts = _twain.Caps.ICAP_JPEGQUALITY.Set(TWJQ.HIGH);
LogIt($"Set jpg quality to {TWJQ.HIGH}", sts);
}
}
}
}
}
}
LogIt("");
}
const ushort TWQC_MACHINE = 0x1000;// applies to entire session/machine
const ushort TWQC_BITONAL = 0x2000; // applies to Bitonal "cameras"
const ushort TWQC_COLOR = 0x4000; // applies to Color "cameras"
[Flags]
public enum TWQC2 : ushort
{
MACHINE = 0x1000,
BITONAL = 0x2000,
COLOR = 0x4000
}
private string FlattenFlag(TWQC val)
{
StringBuilder sb = new();
foreach (var type in Enum.GetValues(typeof(TWQC)))
{
if (((ushort)val & (ushort)type) > 0)
{
sb.Append(type).Append(", ");
}
}
foreach (var type in Enum.GetValues(typeof(TWQC2)))
{
if (((ushort)val & (ushort)type) > 0)
{
sb.Append(type).Append(", ");
}
}
if (sb.Length > 0)
{
sb.Length = sb.Length - 2;
}
return sb.ToString();
}
private void CaptureAsStandardScanner()
{
LogIt("Attempting Standard Scanner mode");
var sts = _twain.Caps.ICAP_PIXELTYPE.Set(TWPT.RGB);
LogIt("Set rgb pixel type", sts);
if (_twain.Caps.CAP_DUPLEXENABLED.Supports.HasFlag(TWQC.SET))
{
sts = _twain.Caps.CAP_DUPLEXENABLED.Set(TW_BOOL.True);
LogIt("Set duplex enabled", sts);
}
var dpi = listDpi.SelectedValue == null ? 300 : Convert.ToInt32(listDpi.SelectedValue);
sts = _twain.Caps.ICAP_XRESOLUTION.Set(dpi);
LogIt("Set x-resolution", sts);
sts = _twain.Caps.ICAP_YRESOLUTION.Set(dpi);
LogIt("Set y-resolution", sts);
if (listFormat.SelectedItem != null)
{
var format = (TWFF)listFormat.SelectedItem;
sts = _twain.Caps.ICAP_IMAGEFILEFORMAT.Set(format);
LogIt($"Set {format} format.", sts);
if (!sts.IsSuccess)
{
return;
}
if (format != TWFF.BMP)
{
if (_twain.Caps.ICAP_COMPRESSION.Supports.HasFlag(TWQC.SET))
{
sts = _twain.Caps.ICAP_COMPRESSION.Set(TWCP.JPEG);
LogIt("Set compression to jpg", sts);
if (sts.IsSuccess)
{
short quality = 90;
sts = _twain.Caps.ICAP_JPEGQUALITY.Set((TWJQ)quality);
LogIt($"Set jpg quality to {quality}", sts);
if (!sts.IsSuccess)
{
quality = 85;
sts = _twain.Caps.ICAP_JPEGQUALITY.Set((TWJQ)quality);
LogIt($"Set jpg quality to {quality}", sts);
if (!sts.IsSuccess)
{
sts = _twain.Caps.ICAP_JPEGQUALITY.Set(TWJQ.HIGH);
LogIt($"Set jpg quality to {TWJQ.HIGH}", sts);
}
}
}
}
}
}
var limit = (short)boxLimit.Value;
sts = _twain.Caps.CAP_XFERCOUNT.Set(limit);
LogIt($"Set transfer limit {boxLimit.Value}", sts);
}
private void btnStop_Click(object sender, EventArgs e)
{
_stopTransfer = true;
}
private void btnBrowseFolder_Click(object sender, EventArgs e)
{
using FolderBrowserDialog dialog = new();
if (dialog.ShowDialog() == DialogResult.OK)
{
boxFolder.Text = dialog.SelectedPath;
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
if (EnsureBoxFolder())
{
try
{
using var p = Process.Start("explorer.exe", boxFolder.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private bool EnsureBoxFolder()
{
if (!string.IsNullOrEmpty(boxFolder.Text))
{
if (!Directory.Exists(boxFolder.Text))
{
try
{
Directory.CreateDirectory(boxFolder.Text);
}
catch (Exception ex)
{
LogIt($"Failed to ensure save folder: {ex.Message}");
return false;
}
}
return true;
}
return false;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,17 @@
namespace ScannerTester
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new MainForm());
}
}
}

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationManifest>app.manifest</ApplicationManifest>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\NTwain\NTwain.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2,PerMonitor</dpiAwareness>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>

View File

@ -1,5 +1,6 @@
using NTwain;
using NTwain.Data;
using NTwain.Data.KDS;
using System.Diagnostics;
namespace WinConsole32
@ -76,7 +77,7 @@ namespace WinConsole32
{
if (e.ImgXferMech == TWSX.FILE)
{
var req = TW_EXTIMAGEINFO.CreateRequest(TWEI.CAMERA, TWEI.HDR_PAGENUMBER, TWEI.HDR_COMPRESSION);
var req = TW_EXTIMAGEINFO.CreateRequest(TWEI.CAMERA, (TWEI)KDS_TWEI.HDR_PAGENUMBER, (TWEI)KDS_TWEI.HDR_COMPRESSION);
e.GetExtendedImageInfo(ref req);
string? camera = null;
@ -90,10 +91,10 @@ namespace WinConsole32
case TWEI.CAMERA:
camera = ei.ReadHandleString(twain);
break;
case TWEI.HDR_PAGENUMBER:
case (TWEI)KDS_TWEI.HDR_PAGENUMBER:
pageNum = ei.ReadNonPointerData<int>();
break;
case TWEI.HDR_COMPRESSION:
case (TWEI)KDS_TWEI.HDR_COMPRESSION:
comp = ei.ReadNonPointerData<TWCP>();
break;
}

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<!--change these in each release-->
<VersionPrefix>4.0.0.0</VersionPrefix>
<VersionSuffix>alpha.9</VersionSuffix>
<VersionSuffix>alpha.10</VersionSuffix>
<!--keep it the same until major # changes-->
<AssemblyVersion>4.0.0.0</AssemblyVersion>
@ -19,7 +19,7 @@
<Copyright>Eugene Wang 2012-2025</Copyright>
<Authors>Eugene Wang</Authors>
<LangVersion>11</LangVersion>
<LangVersion>12</LangVersion>
<!--don't warn missing xml docs, naming conventions, and suppressions-->
<NoWarn>1591,IDE1006,IDE0079</NoWarn>
</PropertyGroup>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,258 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NTwain.Data.KDS;
/// <summary>
/// Custom CAP types for Kodak DS.
/// </summary>
public enum KDS_CAP : ushort
{
CAP_FEEDERKEEPALIVE = 0x8001,
CAP_PAGESIZELIMIT = 0x8002,
CAP_TRANSPORTTIMEOUT = 0x8003,
CAP_WINDOWPOSITION = 0x8004,
ICAP_LAMPSAVER = 0x8005,
ICAP_OVERSCANX = 0x8006,
ICAP_OVERSCANY = 0x8007,
ICAP_FORCECOMPRESSION = 0x8008,
CAP_PRINTERWRITESEQUENCESTRING = 0x8009,
CAP_PRINTERWRITESEQUENCESPACE = 0x800A,
CAP_PRINTERWRITESEQUENCESPACESTRING = 0x800B,
CAP_PRINTERWRITESEQUENCEMESSAGE1 = 0x800C,
CAP_PRINTERWRITESEQUENCEMESSAGE2 = 0x800D,
CAP_PRINTERWRITESEQUENCEMESSAGE3 = 0x800E,
CAP_PRINTERWRITESEQUENCEMESSAGE4 = 0x800F,
CAP_PRINTERWRITESEQUENCEMESSAGE5 = 0x8010,
CAP_PRINTERWRITESEQUENCEMESSAGE6 = 0x8011,
CAP_PRINTERWRITESEQUENCEMESSAGE7 = 0x8012,
CAP_PRINTERWRITESEQUENCEMESSAGE8 = 0x8013,
CAP_PRINTERWRITESEQUENCEMESSAGE9 = 0x8014,
CAP_IMAGEADDRESS = 0x8015,
CAP_IMAGEADDRESSENABLED = 0x8016,
CAP_DOCUMENTCOUNT = 0x8017,
CAP_DOCUMENTCOUNTENABLED = 0x8018,
CAP_MODE = 0x8019,
CAP_PRINTERINDEXFORMAT = 0x801A,
CAP_PRINTERINDEXDIGITS = 0x801B,
CAP_PRINTERDATEDELIMITER = 0x801C,
CAP_CAMERAENABLE = 0x801D,
CAP_CAMERAORDER = 0x801E,
ICAP_HALFTONESQUALITY = 0x801F,
ICAP_COLORTABLE = 0x8020,
ICAP_VERTICALBLACKLINEREMOVAL = 0x8021,
ICAP_CROPPINGMODE = 0x8022,
ICAP_ADDBORDER = 0x8023,
ICAP_FILTERENUM = 0x8024,
ICAP_FILTERTHRESHOLD = 0x8025,
ICAP_FILTERBACKGROUND = 0x8026,
CAP_ULTRASONICSENSITIVITY = 0x8027,
CAP_TRANSPORTTIMEOUTRESPONSE = 0x8028,
CAP_TRANSPORTAUTOSTART = 0x8029,
ICAP_LAMPTIMEOUT = 0x802A,
CAP_BATCHCOUNT = 0x802B,
CAP_PAPERSOURCE = 0x802C,
CAP_MULTIFEEDSOUND = 0x802D,
ICAP_GRAYSCALE = 0x802E,
CAP_ENERGYSTAR = 0x802F,
CAP_BINARIZATION = 0x8030,
CAP_PAGECOUNT = 0x8031,
CAP_NOWAIT = 0x8032,
CAP_PRINTERDATEFORMAT = 0x8033,
CAP_PRINTERWRITESEQUENCEMESSAGE10 = 0x8034,
CAP_PRINTERWRITESEQUENCEMESSAGE11 = 0x8035,
CAP_PRINTERWRITESEQUENCEMESSAGE12 = 0x8036,
CAP_FUNCTIONKEY1 = 0x8037,
CAP_FUNCTIONKEY2 = 0x8038,
CAP_FUNCTIONKEY3 = 0x8039,
CAP_FUNCTIONKEY4 = 0x803A,
CAP_LEVELTOFOLLOW1 = 0x803B,
CAP_LEVELTOFOLLOW2 = 0x803C,
CAP_LEVELTOFOLLOW3 = 0x803D,
CAP_IMAGEADDRESSTEMPLATES = 0x803E,
CAP_BATCHSTARTFUNCTION = 0x803F,
OBS_JPEGQUALITY = 0x8040,
ICAP_COLORSHARPENING = 0x8041,
ICAP_FRAMELENGTHCONTROL = 0x8042,
ICAP_FLIPBACKGROUNDCOLOR = 0x8043,
CAP_PRINTERFONT = 0x8044,
CAP_PRINTERIMAGEADDRESSFORMAT = 0x8045,
CAP_PRINTERPOSITION = 0x8046,
CAP_PRINTERIMAGEADDRESSLEVEL = 0x8047,
CAP_PRINTERWRITESEQUENCEINDEX = 0x8048,
CAP_PRINTERWRITESEQUENCE = 0x8049,
CAP_IMAGEADDRESS_A = 0x804A,
CAP_IMAGEADDRESS_B = 0x804B,
CAP_IMAGEADDRESS_C = 0x804C,
CAP_IMAGEADDRESS_D = 0x804D,
CAP_BATCHLEVEL = 0x804E,
CAP_BATCHENDFUNCTION = 0x804F,
// Reserved 0x8050 - 0x8053,
CAP_ENABLECOLORPATCHCODE = 0x8054,
CAP_FIXEDDOCUMENTSIZE = 0x8055,
CAP_DOUBLEFEEDSTOP = 0x8056,
CAP_MULTIFEEDTHICKNESSDETECTION = 0x8057,
// Reserved 0x8058 - 0x8069,
CAP_PCARDENABLED = 0x806A,
CAP_IMAGEMAGNIFICATIONFACTOR = 0x806B,
CAP_INDICATORSWARMUP = 0x806C,
CAP_TOGGLEPATCH = 0x806D,
CAP_DOUBLEFEEDENDJOB = 0x806E,
CAP_FEEDERMODE = 0x806F,
CAP_FOLDEDCORNER = 0x8070,
CAP_FOLDEDCORNERSENSITIVITY = 0x8071,
ICAP_GAMMAENABLED = 0x8074,
CAP_EASYSTACKING = 0x8075,
// Reserved 0x8076 - 0x8085,
CAP_MULTIFEEDCOUNT = 0x8086,
CAP_PATCHCOUNT = 0x8087,
ICAP_FILTERPROCESSING = 0x8088,
CAP_BACKGROUND = 0x8089,
CAP_PRINTERWRITESEQUENCEMESSAGEINDEX = 0x808A,
CAP_CHECKDIGIT = 0x808B,
CAP_BACKGROUNDFRONT = 0x808C,
CAP_BACKGROUNDREAR = 0x808D,
CAP_BACKGROUNDPLATEN = 0x808E,
CAP_ULTRASONICSENSORCENTER = 0x808F,
CAP_ULTRASONICSENSORLEFT = 0x8090,
CAP_ULTRASONICSENSORRIGHT = 0x8091,
ICAP_AUTOCOLORAMOUNT = 0x8092,
ICAP_AUTOCOLORCONTENT = 0x8093,
ICAP_AUTOCOLORTHRESHOLD = 0x8094,
ICAP_IMAGEEDGEFILL = 0x8095,
ICAP_IMAGEEDGELEFT = 0x8096,
ICAP_IMAGEEDGERIGHT = 0x8097,
ICAP_IMAGEEDGETOP = 0x8098,
ICAP_IMAGEEDGEBOTTOM = 0x8099,
CAP_BLANKPAGE = 0x809A,
CAP_BLANKPAGEMODE = 0x809B,
CAP_BLANKPAGECOMPSIZEBW = 0x809C,
CAP_BLANKPAGECOMPSIZEGRAY = 0x809D,
CAP_BLANKPAGECOMPSIZERGB = 0x809E,
CAP_PROFILES = 0x809F,
ICAP_ANSELBRIGHTNESS = 0x80A0,
ICAP_ANSELCONTRAST = 0x80A1,
ICAP_ANSELHIGHLIGHT = 0x80A2,
ICAP_ANSELMIDTONE = 0x80A3,
ICAP_ANSELREMOVEREDEYE = 0x80A4,
ICAP_ANSELRESTORECOLOR = 0x80A5,
ICAP_ANSELSATURATECOLORS = 0x80A6,
ICAP_ANSELSHADOW = 0x80A7,
ICAP_ANSELSHARPENIMAGE = 0x80A8,
ICAP_ANSELSHASTA = 0x80A9,
ICAP_PADDING = 0x80AA,
ICAP_NEWWINDOWSIZE = 0x80AB,
ICAP_DOCUMENTTYPE = 0x80AC,
CAP_WINDOW = 0x80AD,
ICAP_BACKGROUNDADJUSTMODE = 0x80AE,
ICAP_BACKGROUNDADJUSTAPPLYTO = 0x80AF,
ICAP_BACKGROUNDADJUSTAGGRESSIVENESS = 0x80B0,
ICAP_COLORBALANCEBLUE = 0x80B1,
ICAP_COLORBALANCEGREEN = 0x80B2,
ICAP_COLORBALANCERED = 0x80B3,
CAP_WINDOWCAMERA = 0x80B4,
ICAP_SKEWANGLE = 0x80B5,
ICAP_MEDIATYPE = 0x80B6,
CAP_SIDESDIFFERENT = 0x80B7,
ICAP_ECDO = 0x80B8,
ICAP_IMAGEEDGEFILLALLSIDES = 0x80B9,
CAP_MULTIFEEDRESPONSE = 0x80BA,
ICAP_FRAMESANGLE = 0x80BB,
CAP_PRINTERDATE = 0x80BC,
CAP_PRINTERTIME = 0x80BD,
CAP_PRINTERFONTFORMAT = 0x80BE,
CAP_PATCHHEAD1 = 0x80BF,
CAP_PATCHHEAD2 = 0x80C0,
CAP_PATCHHEAD3 = 0x80C1,
CAP_PATCHHEAD4 = 0x80C2,
ICAP_ECDOTREATASCOLOR = 0x80C3,
CAP_BLANKPAGECONTENT = 0x80C4,
CAP_IMAGEMERGE = 0x80C5,
ICAP_STREAKREMOVALENABLED = 0x80C6,
ICAP_STREAKREMOVALAGGRESSIVENESS = 0x80C7,
// Reserved 0x80C8 - 0x80FF,
CAP_IMAGESDIFFERENT = 0x8100,
ICAP_PHYSICALHEIGHTADJUST = 0x8101,
ICAP_COLORSHARPEN = 0x8102,
ICAP_ECDOAGGRESSIVENESS = 0x8103,
ICAP_HOLEFILLENABLED = 0x8104,
CAP_ULTRASONICSENSORLEFTCENTER = 0x8105,
CAP_ULTRASONICSENSORRIGHTCENTER = 0x8106,
CAP_ULTRASONICSENSORZONEHEIGHT = 0x8107,
ICAP_COLORBRIGHTNESSMODE = 0x8108,
ICAP_COLORBALANCEMODE = 0x8109,
ICAP_COLORBALANCEAUTOMATICAGGRESSIVENESS = 0x810A,
CAP_SIMULATING = 0x810B,
CAP_POWEROFFTIMEOUT = 0x810C,
CAP_INTELLIGENTDOCUMENTPROTECTION = 0x810D,
ICAP_FOREGROUNDBOLDNESSAGGRESSIVENESS = 0x810E,
ICAP_FOREGROUNDBOLDNESSMODE = 0x810F,
CAP_DUALSTACKINGENABLED = 0x8110,
CAP_DUALSTACKINGLENGTHMODE = 0x8111,
CAP_DUALSTACKINGLENGTH1 = 0x8112,
CAP_DUALSTACKINGLENGTH2 = 0x8113,
CAP_DUALSTACKINGMULTIFEED = 0x8114,
CAP_DUALSTACKINGPATCHTRANSFER = 0x8115,
CAP_DUALSTACKINGPATCHTYPE1 = 0x8116,
CAP_DUALSTACKINGPATCHTYPE2 = 0x8117,
CAP_DUALSTACKINGPATCHTYPE3 = 0x8118,
CAP_DUALSTACKINGPATCHTYPE4 = 0x8119,
CAP_DUALSTACKINGPATCHTYPE6 = 0x811A,
CAP_DUALSTACKINGSTACK = 0x811B,
CAP_INDEXINGFORMAT = 0x811C,
CAP_CARTRIDGEDETECTED = 0x811D,
ICAP_BARCODECOUNT = 0x811E,
ICAP_BARCODEENHANCEMENT = 0x811F,
ICAP_BARCODESEARCHAREA = 0x8120,
ICAP_BARCODESEARCHREGION = 0x8121,
ICAP_TEXTENHANCEMENT = 0x8122,
ICAP_THINTHICKENAMOUNT = 0x8123,
CAP_POWEROFFTIMEOUTENABLED = 0x8124,
CAP_PAPERJAMRESPONSE = 0x8125,
CAP_PRINTERTIMEFORMAT = 0x8126,
CAP_PRINTERINDEXINCREMENT = 0x8127,
CAP_PRINTERINDEXRESET = 0x8128,
CAP_PRINTERINDEXRESETVALUE = 0x8129,
CAP_PRINTONIMAGEFRONT = 0x812A,
CAP_PRINTONIMAGEREAR = 0x812B,
CAP_PRINTONIMAGEPOSITIONX = 0x812C,
CAP_PRINTONIMAGEPOSITIONY = 0x812D,
ICAP_ECDOINCLUDENONDROPPED = 0x812E,
CAP_PATCHTYPE10 = 0x812F,
CAP_PATCHTYPE11 = 0x8130,
CAP_PATCHTYPE12 = 0x8131,
CAP_PATCHTYPE13 = 0x8132,
CAP_PATCHTYPE14 = 0x8133,
CAP_PATCHTYPE15 = 0x8134,
CAP_INDEXINGDOCUMENT = 0x8135,
CAP_INDEXINGSHEET = 0x8136,
CAP_INDEXINGPRINTONPATCH = 0x8137,
CAP_PRINTERFONTRESIZE = 0x8138,
CAP_DUALSTACKINGPATCHTYPE10 = 0x8139,
CAP_DUALSTACKINGPATCHTYPE11 = 0x813A,
CAP_DUALSTACKINGPATCHTYPE12 = 0x813B,
CAP_DUALSTACKINGPATCHTYPE13 = 0x813C,
CAP_DUALSTACKINGPATCHTYPE14 = 0x813D,
CAP_DUALSTACKINGPATCHTYPE15 = 0x813E,
CAP_PAPERDESTINATION = 0x813F,
CAP_ACTIVEFEED = 0x8140,
CAP_ENHANCEDSEPARATION = 0x8141,
CAP_FLATBEDMULTIDOCLOCATE = 0x8142,
CAP_SLEEVEMULTIDOCLOCATE = 0x8143,
CAP_SLEEVEDOCUMENT = 0x8144,
CAP_SPLITDOCUMENTCOUNT = 0x8145,
CAP_SPLITDOCUMENTLENGTHMODE = 0x8146,
CAP_SPLITDOCUMENTLENGTH1 = 0x8147,
CAP_SPLITDOCUMENTLENGH2 = 0x8148,
CAP_KADIGITALSTAMPINGSUPPORTED = 0x8149,
ICAP_AUTOCOLORIGNOREBACKGROUND = 0x814A,
CAP_SNAPTOSIZEENABLED = 0x814B,
CAP_SNAPTOSIZE = 0x814C,
ICAP_IMAGEROTATEORTHOGONALCHARSET = 0x814D,
CAP_KADIGITALSTAMPCOUNT = 0x814E,
CAP_KAEKLOGUSESZIP = 0x814F,
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NTwain.Data.KDS;
public enum KDS_DAT : ushort
{
STATUSRAW = 0x8001,
PCARD = 0x8002,
COLORTABLEMAP = 0x8003,
DEVICEINFO = 0x8005,
AUTOCOLORLEARN = 0x8006,
PROFILES = 0x8007,
WINDOW = 0x8008,
CUSTOMDSDATAGROUP = 0x8009,
ECDO = 0x800A,
QUERYSUPPORT = 0x800B,
LOG = 0x800C,
UTC = 0x800D,
OCPBUTTONS = 0x800E,
CONSUMABLEMETERS = 0x8010
}

View File

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NTwain.Data.KDS;
public enum KDS_MSG : ushort
{
SETUPDS = 0x8002,
DISABLEUI = 0x8003,
ENABLEUI = 0x8004,
GETSPECIAL = 0x8005,
ENABLESCANNER = 0x8006,
/// <summary>
/// Deprecated TWAIN 10.x+
/// </summary>
SAVEPROFILE = 0x8008,
/// <summary>
/// Deprecated TWAIN 10.x+
/// </summary>
DELETEPROFILE = 0x8009,
// Reserved =0x8007, =0x800A - =0x8010, =0x8013 - =0x8014, =0x801F
ADDWINDOW = 0x8011,
DELETEWINDOW = 0x8012,
PROFILECREATE = 0x8015,
PROFILEDELETE = 0x8016,
PROFILESAVE = 0x8017,
PROFILERENAME = 0x8018,
PROFILERESTORE = 0x8019,
PROFILEEXPORT = 0x801A,
PROFILEIMPORT = 0x801B,
PROFILESET = 0x801C,
GETINQUIRY = 0x801D,
ENDXFERSPECIAL = 0x801E,
RESOURCELOCK = 0x801F,
RESOURCEUNLOCK = 0x8020
}

View File

@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NTwain.Data.KDS;
public enum KDS_TWEI : ushort
{
HDR_PAGESIDE = 0x8001, // 0-front 1-rear
HDR_DOCUMENTCOUNT = 0x8002, // Count of pages (seeded by user)
HDR_LENGTH = 0x8003, // Number of bytes of image data
HDR_LEVEL = 0x8004, // Image Address Level
HDR_MODE = 0x8005, // Gemini Mode (1-18)
HDR_LINELENGTH = 0x8006, // Width
HDR_PAGELENGTH = 0x8007, // Height
HDR_COMPRESSION = 0x8008, // ICAP_COMPRESSION TWCP_* value
HDR_DATE = 0x8009, // YY/MM/DD
HDR_TIME = 0x800A, // HH/MM/00
HDR_ROLL = 0x800B, // Imagelink 990 Film Roll Number
HDR_RESOLUTION = 0x800C, // Dots Per Inch (DPI)
HDR_BITORDER = 0x800D, // Bit order in a byte
HDR_SKEW = 0x800E, // (obsolete)
HDR_MOMENTARYFLAG = 0x800F, // Gemini Momentary
HDR_LATCHEDFLAG = 0x8010, // Gemini Latched
HDR_BARCODE = 0x8011, // Gemini Barcode(s)
HDR_DESKEW = 0x8012, // Deskew status
HDR_DESKEWANGLE = 0x8013, // Deskew angle
HDR_POLARITY = 0x8014, // ICAP_PIXELFLAVOR TWPF_* value
HDR_PRINTERSTRING = 0x8015, // Viper/Prism/Wildfire printed string
HDR_PRINTERINDEX = 0x8016, // Kinda like the document count
HDR_IMAGENUMBER = 0x8017, // Count images this session
HDR_PAGENUMBER = 0x8018, // Count sheets of paper this session
HDR_PAGEIMAGENUMBER = 0x8019, // Image count on a page (1 - 4)
HDR_BOOKNAME_A = 0x801A, // Fixed field Gemini/Prism/Wildfire A
HDR_BOOKNAME_B = 0x801B, // Fixed field Prism/Wildfire B
HDR_BOOKNAME_C = 0x801C, // Fixed field Prism/Wildfire C
HDR_BOOKNAME_D = 0x801D, // Fixed field Prism/Wildfire D
HDR_IMAGEADDRESSSTRING = 0x801E, // Prism/Wildfire image address string
HDR_XOFFSET = 0x801F, // Left cropping offset
HDR_YOFFSET = 0x8020, // Right cropping offset
HDR_FEATUREPATCH = 0x8021, // Feature patch (only image with patch: i200/i600)
HDR_IMAGEADDRESSDEFS = 0x8022, // Image Address field definitions
HDR_PCARD_HEADER = 0x8023, // Personality-Card Header
HDR_PCARD_FOOTER = 0x8024, // Personality-Card Footer
HDR_TOKEN_COUNT = 0x8025, // Alien token flag
HDR_REGENERATION = 0x8026, // Alien retry count
HDR_IMAGESTATUS = 0x8027, // Alien image status
HDR_DITHER = 0x8028, // Bitonal dithering algorithm used
HDR_PATCHDETECTED = 0x8029, // Patch was found on the document
HDR_FOLDEDCORNERPERCENTAGE = 0x802A, // Phoenix folded corner percentage
HDR_DESKEWCONFIDENCEFACTOR = 0x802B, // Phoenix deskew confidence factor
HDR_BITONALCONTRASTPERCENTAGE = 0x802C, // Phoenix bitonal contrast percentage
HDR_BITONALCONTRAST = 0x802D, // Phoenix bitonal contrast
HDR_BITONALTHRESHOLD = 0x802E, // Phoenix bitonal threshold
HDR_SUMHISTOGRAM = 0x802F, // Phoenix sum historgram
HDR_DIFFERENCEHISTOGRAM = 0x8030, // Phoenix difference histogram
HDR_GAMMATABLE = 0x8031, // Phoenix gamma table
HDR_MULTIFEED = 0x8032, // Multifeed detected
HDR_DESKEWANGLEACTUAL = 0x8033, // Signed deskew angle to scanner precision
HDR_RAWIMAGEHEADER = 0x8034, // Raw image header from scanner
HDR_LONGPAPERSEGMENT = 0x8035, // Long paper segment number
HDR_LONGPAPERLASTSEGMENT = 0x8036, // Long pager last segment
HDR_AUTOCOLORDETECTED = 0x8037, // Auto color detected
HDR_AUTOCOLORAMOUNT = 0x8038, // Auto color amount
HDR_AUTOCOLORTHRESHOLD = 0x8039, // Auto color threshold
HDR_XML = 0x803A, // <reportimage> data in XML format (see sample at end of file)
HDR_DROPOUTSTATUS = 0x803B, // ECDO Algorithm Status
HDR_PROCESSINGSTATUS = 0x803C, // Processing Status
HDR_BINARIZATIONQUALITY = 0x803D, // Conveys the quality level of the binarized image
HDR_DUALSTACKINGSTACK = 0x803E, // Which output tray a document was dropped into (i5000 only)
// Only valid if dual stacking is enabled; legal values are 1 and 2
HDR_PAPERDESTINATION = 0x803F, // Which output tray a document
// was dropped into (i5000 only)
HDR_SLEEVETYPE = 0x8040, // Type of sleeve that was detected during Sleeve Scanning
HDR_MULTIIMAGEINDEX = 0x8041, // Image ID for the image that was split from a document
HDR_MULTIIMAGETOTAL = 0x8042, // Total number of images split from a document
HDR_ENDOFSHEET = 0x8043, // Is this the last image on this sheet? (0-no or 1-yes)
HDR_STAMPEDSTRING = 0x8044, // Stamped string
HDR_STAMPCOUNT = 0x8045, // Digital Stamping Counter
}

View File

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NTwain.Data.KDS;
public enum KDS_TWRC : ushort
{
BUSY = 0x8001,
PCARD_CHECKSTATUS = 0x8002,
PCARD_FATAL = 0x8003,
PCARD_RETRYIMAGE = 0x8004,
PCARD_NOCARD = 0x8005,
FILTER_CONTINUE = 0x8010,
}

View File

@ -3994,11 +3994,6 @@ namespace NTwain.Data
// used with DAT_TWAINDIRECT
SETTASK = 0x0B01,
/// <summary>
/// KODAK only. Used with DAT_EXTIMAGEINFO in state 6.
/// </summary>
GETSPECIAL = 0x8005
}
#endregion
@ -4311,79 +4306,6 @@ namespace NTwain.Data
IALEVEL = 0x1251,
PRINTER = 0x1252,
BARCODETEXT2 = 0x1253,
// KODAK USE
HDR_PAGESIDE = 0x8001, // 0-front 1-rear
HDR_DOCUMENTCOUNT = 0x8002, // Count of pages (seeded by user)
HDR_LENGTH = 0x8003, // Number of bytes of image data
HDR_LEVEL = 0x8004, // Image Address Level
HDR_MODE = 0x8005, // Gemini Mode (1-18)
HDR_LINELENGTH = 0x8006, // Width
HDR_PAGELENGTH = 0x8007, // Height
HDR_COMPRESSION = 0x8008, // ICAP_COMPRESSION TWCP_* value
HDR_DATE = 0x8009, // YY/MM/DD
HDR_TIME = 0x800A, // HH/MM/00
HDR_ROLL = 0x800B, // Imagelink 990 Film Roll Number
HDR_RESOLUTION = 0x800C, // Dots Per Inch (DPI)
HDR_BITORDER = 0x800D, // Bit order in a byte
HDR_SKEW = 0x800E, // (obsolete)
HDR_MOMENTARYFLAG = 0x800F, // Gemini Momentary
HDR_LATCHEDFLAG = 0x8010, // Gemini Latched
HDR_BARCODE = 0x8011, // Gemini Barcode(s)
HDR_DESKEW = 0x8012, // Deskew status
HDR_DESKEWANGLE = 0x8013, // Deskew angle
HDR_POLARITY = 0x8014, // ICAP_PIXELFLAVOR TWPF_* value
HDR_PRINTERSTRING = 0x8015, // Viper/Prism/Wildfire printed string
HDR_PRINTERINDEX = 0x8016, // Kinda like the document count
HDR_IMAGENUMBER = 0x8017, // Count images this session
HDR_PAGENUMBER = 0x8018, // Count sheets of paper this session
HDR_PAGEIMAGENUMBER = 0x8019, // Image count on a page (1 - 4)
HDR_BOOKNAME_A = 0x801A, // Fixed field Gemini/Prism/Wildfire A
HDR_BOOKNAME_B = 0x801B, // Fixed field Prism/Wildfire B
HDR_BOOKNAME_C = 0x801C, // Fixed field Prism/Wildfire C
HDR_BOOKNAME_D = 0x801D, // Fixed field Prism/Wildfire D
HDR_IMAGEADDRESSSTRING = 0x801E, // Prism/Wildfire image address string
HDR_XOFFSET = 0x801F, // Left cropping offset
HDR_YOFFSET = 0x8020, // Right cropping offset
HDR_FEATUREPATCH = 0x8021, // Feature patch (only image with patch: i200/i600)
HDR_IMAGEADDRESSDEFS = 0x8022, // Image Address field definitions
HDR_PCARD_HEADER = 0x8023, // Personality-Card Header
HDR_PCARD_FOOTER = 0x8024, // Personality-Card Footer
HDR_TOKEN_COUNT = 0x8025, // Alien token flag
HDR_REGENERATION = 0x8026, // Alien retry count
HDR_IMAGESTATUS = 0x8027, // Alien image status
HDR_DITHER = 0x8028, // Bitonal dithering algorithm used
HDR_PATCHDETECTED = 0x8029, // Patch was found on the document
HDR_FOLDEDCORNERPERCENTAGE = 0x802A, // Phoenix folded corner percentage
HDR_DESKEWCONFIDENCEFACTOR = 0x802B, // Phoenix deskew confidence factor
HDR_BITONALCONTRASTPERCENTAGE = 0x802C, // Phoenix bitonal contrast percentage
HDR_BITONALCONTRAST = 0x802D, // Phoenix bitonal contrast
HDR_BITONALTHRESHOLD = 0x802E, // Phoenix bitonal threshold
HDR_SUMHISTOGRAM = 0x802F, // Phoenix sum historgram
HDR_DIFFERENCEHISTOGRAM = 0x8030, // Phoenix difference histogram
HDR_GAMMATABLE = 0x8031, // Phoenix gamma table
HDR_MULTIFEED = 0x8032, // Multifeed detected
HDR_DESKEWANGLEACTUAL = 0x8033, // Signed deskew angle to scanner precision
HDR_RAWIMAGEHEADER = 0x8034, // Raw image header from scanner
HDR_LONGPAPERSEGMENT = 0x8035, // Long paper segment number
HDR_LONGPAPERLASTSEGMENT = 0x8036, // Long pager last segment
HDR_AUTOCOLORDETECTED = 0x8037, // Auto color detected
HDR_AUTOCOLORAMOUNT = 0x8038, // Auto color amount
HDR_AUTOCOLORTHRESHOLD = 0x8039, // Auto color threshold
HDR_XML = 0x803A, // <reportimage> data in XML format (see sample at end of file)
HDR_DROPOUTSTATUS = 0x803B, // ECDO Algorithm Status
HDR_PROCESSINGSTATUS = 0x803C, // Processing Status
HDR_BINARIZATIONQUALITY = 0x803D, // Conveys the quality level of the binarized image
HDR_DUALSTACKINGSTACK = 0x803E, // Which output tray a document was dropped into (i5000 only)
// Only valid if dual stacking is enabled; legal values are 1 and 2
HDR_PAPERDESTINATION = 0x803F, // Which output tray a document
// was dropped into (i5000 only)
HDR_SLEEVETYPE = 0x8040, // Type of sleeve that was detected during Sleeve Scanning
HDR_MULTIIMAGEINDEX = 0x8041, // Image ID for the image that was split from a document
HDR_MULTIIMAGETOTAL = 0x8042, // Total number of images split from a document
HDR_ENDOFSHEET = 0x8043, // Is this the last image on this sheet? (0-no or 1-yes)
HDR_STAMPEDSTRING = 0x8044, // Stamped string
HDR_STAMPCOUNT = 0x8045, // Digital Stamping Counter
}
public enum TWEJ : ushort

View File

@ -1,4 +1,5 @@
using NTwain.Data;
using NTwain.Data.KDS;
using NTwain.DSM;
namespace NTwain.Triplets.ImageDATs;
@ -59,11 +60,11 @@ public class ExtImageInfo
{
if (TWPlatform.Is32bit && TWPlatform.PreferLegacyDSM)
{
rc = WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.IMAGE, DAT.EXTIMAGEINFO, MSG.GETSPECIAL, ref data);
rc = WinLegacyDSM.DSM_Entry(ref app, ref ds, DG.IMAGE, DAT.EXTIMAGEINFO, (MSG)KDS_MSG.GETSPECIAL, ref data);
}
else
{
rc = WinNewDSM.DSM_Entry(ref app, ref ds, DG.IMAGE, DAT.EXTIMAGEINFO, MSG.GETSPECIAL, ref data);
rc = WinNewDSM.DSM_Entry(ref app, ref ds, DG.IMAGE, DAT.EXTIMAGEINFO, (MSG)KDS_MSG.GETSPECIAL, ref data);
}
}
else if (TWPlatform.IsMacOSX)
@ -72,11 +73,11 @@ public class ExtImageInfo
TW_IDENTITY_MACOSX ds2 = ds;
if (TWPlatform.PreferLegacyDSM)
{
rc = OSXLegacyDSM.DSM_Entry(ref app2, ref ds2, DG.IMAGE, DAT.EXTIMAGEINFO, MSG.GETSPECIAL, ref data);
rc = OSXLegacyDSM.DSM_Entry(ref app2, ref ds2, DG.IMAGE, DAT.EXTIMAGEINFO, (MSG)KDS_MSG.GETSPECIAL, ref data);
}
else
{
rc = OSXNewDSM.DSM_Entry(ref app2, ref ds2, DG.IMAGE, DAT.EXTIMAGEINFO, MSG.GETSPECIAL, ref data);
rc = OSXNewDSM.DSM_Entry(ref app2, ref ds2, DG.IMAGE, DAT.EXTIMAGEINFO, (MSG)KDS_MSG.GETSPECIAL, ref data);
}
}
return rc;