←Select platform

Format Property

Summary
Gets or sets the preferred image format to use when performing data transfer from WIA source.

Syntax
C#
C++/CLI
Python
public WiaFileFormats Format { get; set; } 
public: 
property WiaFileFormats Format { 
   WiaFileFormats get(); 
   void set (    WiaFileFormats ); 
} 
Format # get and set (WiaDataTransferProperties) 

Property Value

The preferred image format to use when performing data transfer from WIA source. Possible values are (according to Microsoft SDK documentation):

WiaFileFormats.None

Use this value only to determine whether the WiaDataTransferProperties structure is filled with a valid format.

WiaFileFormats.MemoryBmp

Windows bitmap without a header file (use this format when doing memory transfer).

WiaFileFormats.Bmp

Windows bitmap with a header file.

WiaFileFormats.Ciff

Camera Image File format (not supported in Windows Vista).

WiaFileFormats.Emf

Extended Windows metafile.

WiaFileFormats.Exif

Exchangeable File Format.

WiaFileFormats.Fpx

FlashPix format.

WiaFileFormats.Gif

GIF image format.

WiaFileFormats.Ico

Windows icon file format.

WiaFileFormats.Jbig

The Joint Bi-level Image Experts Group (JBIG) format (supported only in Windows Vista and later).

WiaFileFormats.Jpeg

JPEG compressed format.

WiaFileFormats.J2k

JPEG 2000 compressed format.

WiaFileFormats.J2kx

JPEG 2000 compressed format.

WiaFileFormats.Pcd

Eastman Kodak file format.

WiaFileFormats.Pct

Apple file format.

WiaFileFormats.Png

W3C PNG format.

WiaFileFormats.Raw

Raw format for data transfers only.

WiaFileFormats.RawRgb

Raw RGB format.

WiaFileFormats.Tiff

Tag Image File Format.

WiaFileFormats.Wmf

Windows metafile.

WiaFileFormats.Rtf

Rich Text File format.

WiaFileFormats.Xml

XML file.

WiaFileFormats.Html

HTML format.

WiaFileFormats.Txt

Text file.

WiaFileFormats.Pdfa

The PDF/A (ISO/CD 19005-1) format (supported only in Windows Vista and later).

WiaFileFormats.Xps

XML Paper Specification (XPS) Package format (supported only in Windows Vista and later).

WiaFileFormats.Mpg

MPEG video format (not supported in either Windows Server 2003 or Windows Vista).

WiaFileFormats.Avi

AVI video format (not supported in either Windows Server 2003 or Windows Vista).

WiaFileFormats.Wav

WAV audio format.

WiaFileFormats.Mp3

MP3 audio format.

WiaFileFormats.Aiff

AIFF audio format.

WiaFileFormats.Wma

WMA audio format.

WiaFileFormats.Asf

WMV video format (not supported in either Windows Server 2003 or Windows Vista).

WiaFileFormats.Script

Script file.

WiaFileFormats.Exec

Executable file.

WiaFileFormats.Unicode16

UNICODE 16-bit encoding.

WiaFileFormats.Dpof

DPOF printing format.

For more information about these compression types, refer to WIA_IPA_FORMAT property ID in Microsoft Windows SDK Documentation.

Example
C#
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()); 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Wia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.