void Scan() { var identity = TWIdentity.CreateFromAssembly(DataGroups.Image, Assembly.GetEntryAssembly()); var twain = new TwainSession(identity); twain.Open(); twain.DataTransferred += (s, e) => { var stream = e.GetNativeImageStream(); var image = Image.FromStream(stream); // Do things with the image... }; var source = twain.First(); Console.WriteLine($"Scanning from {source.Name}..."); var openCode = source.Open(); Console.WriteLine($"Open: {openCode}"); source.Enable(SourceEnableMode.NoUI, false, IntPtr.Zero); }