Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
i want to load int database field in dpi scanner option how to access it from c#

http://imageshack.us/photo/my-images/811/62695829.png/[^]
Posted
Comments
Kenneth Haugland 5-Aug-12 7:14am    
What is stopping you from doing it? Were excactly are you stuck, and did you google it first?
Sergey Alexandrovich Kryukov 5-Aug-12 18:26pm    
Not a question. Why changing resolution? This is nothing by a piece of metadata (not in all image formats). If the scan is already done, you cannot change the image quality by changing resolution.
--SA

1 solution

You want to store the DPI used by your scanner in your db ? It's just an int, storing it is easy. Setting it is the hard bit. There's no TWAIN support in C#, and limited WIA support, so, it depends on if your scanning code has access to DPI settings.

I found this code using google. You should try it.
C#
   private void setItem(IItem item, object property, object value)
       {
           WIA.Property aProperty = item.Properties.get_Item(ref property);
           aProperty.set_Value(ref value);
       }



       internal bool Scan(bool flatBed)
       {

           WIA.DeviceManager manager = new DeviceManager();
           bool result = false;
           object something = 1;
           object somethingElse;
           WIA.Device scanner = manager.DeviceInfos.get_Item(ref something).Connect();
           IItem item = scanner.Items[1];

           setItem(item, "6146", 4);
           setItem(item, "6147", 200);
           setItem(item, "6148", 200);
           setItem(item, "6151", 200 * 8.5);
           setItem(item, "6152", 200 * 11);
}




The first setItem is the color [4 black and white, 2 grayscale, 1 color, 0 unspecified]

The second is horizontal resolution.

The third is veritcal resolution.

The fourth is horizontal scanning area.

The fifth is vertical scanning area.
 
Share this answer
 
Comments
nagiub2007 6-Aug-12 5:12am    
nice
thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900