public enum WiaFileFormats
Value | Member | Description |
---|---|---|
0 | None | Indicates that there is no transfer format currently set. The purpose of this member is to determine whether the WiaDataTransferProperties structure has a valid transfer format set. |
1 | Bmp | (0x0000000C)Windows bitmap with a header file. |
2 | Ciff | Camera Image File format |
3 | Emf | Extended Windows metafile. |
4 | Exif | Exchangeable File Format. |
5 | Fpx | FlashPix format. |
6 | Gif | GIF image format. |
7 | Ico | Windows icon file format. |
8 | Jbig | The Joint Bi-level Image Experts Group (JBIG) format (supported only in Windows Vista and later). |
9 | Jpeg | JPEG compressed format. |
10 | J2k | JPEG 2000 compressed format. |
11 | J2kx | JPEG 2000 compressed format. |
12 | MemoryBmp | Windows bitmap without a header file (use this format when doing memory transfer). |
13 | Pcd | Eastman Kodak file format. |
14 | Pct | Apple file format. |
15 | Png | W3C PNG format. |
16 | Raw | Raw format for data transfers only. |
17 | RawRgb | Raw RGB format. |
18 | Tiff | Tag Image File Format. |
19 | Wmf | Windows metafile. |
20 | Rtf | Rich Text File format. |
21 | Xml | XML file. |
22 | Html | HTML format. |
23 | Txt | Text file. |
24 | Pdfa | The PDF/A (ISO/CD 19005-1) format (supported only in Windows Vista and later). |
25 | Xps | XML Paper Specification (XPS) Package format (supported only in Windows Vista and later). |
26 | Mpg | MPEG video format (not supported in either Windows Server 2003 or Windows Vista). |
27 | Avi | AVI video format (not supported in either Windows Server 2003 or Windows Vista). |
28 | Wav | WAV audio format. |
29 | Mp3 | MP3 audio format. |
30 | Aiff | AIFF audio format. |
31 | Wma | WMA audio format. |
32 | Asf | WMV video format (not supported in either Windows Server 2003 or Windows Vista). |
33 | Script | Script file. |
34 | Exec | Executable file. |
35 | Unicode16 | UNICODE 16-bit encoding. |
36 | Dpof | DPOF printing format. |
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Wia;
WiaSession wiaSession;
public void GetRootItemExample(IntPtr parent)
{
if (!WiaSession.IsAvailable(WiaVersion.Version1))
{
Console.WriteLine("WIA version 1.0 not installed.");
return;
}
wiaSession = new WiaSession();
wiaSession.Startup(WiaVersion.Version1);
DialogResult res = wiaSession.SelectDeviceDlg(parent, WiaDeviceType.Default, WiaSelectSourceFlags.NoDefault);
if (res != DialogResult.OK)
{
Console.WriteLine("Error selecting WIA device.");
wiaSession.Shutdown();
return;
}
object rootItem = wiaSession.GetRootItem(null);
if (rootItem != null)
{
wiaSession.EnumItemsEvent += new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent);
wiaSession.EnumChildItems(rootItem);
wiaSession.EnumItemsEvent -= new EventHandler<WiaEnumItemsEventArgs>(wiaSession_EnumItemsEvent);
}
wiaSession.Shutdown();
}
void wiaSession_EnumItemsEvent(object sender, WiaEnumItemsEventArgs e)
{
if (e.Item != null)
{
WiaDataTransferProperties dataTransfer = WiaDataTransferProperties.Empty;
WiaImageEffectsProperties imageEffects = WiaImageEffectsProperties.Empty;
WiaProperties properties = wiaSession.GetProperties(e.Item);
dataTransfer.ImageDataType = WiaImageDataType.Grayscale;
imageEffects.Brightness = 250;
properties.DataTransfer = dataTransfer;
properties.ImageEffects = imageEffects;
properties.ScanningMode = WiaScanningModeFlags.Feeder; // set scanning source to Feeder
properties.MaximumNumberOfPages = 0; // scan all pages in feeder
properties.ImageType = WiaImageType.Grayscale;
properties.Orientation = WiaOrientation.Portrait;
WiaImageResolutionProperties imageResolution = properties.ImageResolution;
imageResolution.BitsPerPixel = 8;
imageResolution.HorizontalResolution = 600;
imageResolution.VerticalResolution = 600;
properties.ImageResolution = imageResolution;
wiaSession.SetPropertiesEvent += new EventHandler<WiaSetPropertiesEventArgs>(wiaSession_SetPropertiesEvent);
wiaSession.SetProperties(e.Item, properties);
wiaSession.SetPropertiesEvent -= new EventHandler<WiaSetPropertiesEventArgs>(wiaSession_SetPropertiesEvent);
wiaSession.FreeItem(e.Item);
}
}
void wiaSession_SetPropertiesEvent(object sender, WiaSetPropertiesEventArgs e)
{
if (e.Error <= 0)
{
Console.WriteLine("Failed to set the below property:\n\tProperty Id: {0}\n\tProperty Value: {1}\n\tError: {2}\n\n", e.PropertyId.ToString(), e.Value.ToString(), e.Error.ToString());
}
}