ImageGear Professional v18.2 > User Guide > Using ImageGear > Working with Non-Image Data > IGMetaDataItem Object |
The 3 metadata Event Handlers are all passed a copy of the IGMetadataItem Object. The Event Handler in your application will either inspect this object to obtain the metadata item, or will set the values in this object to change or create the metadata item. The rules for each of these values are dependent on the file-type. See Non-Image Data Storage for more information.
The values in the IGMetadataItem Object are as follows:
FilterID | Identifies the file-type. One of the enumIGFormats Enumeration values. |
---|---|
ID | Numerical ID of data item. |
Name | The name of the data item. |
Type |
One of the following (see Metadata Structure):
|
ValueType | Contains the type identifier of the item in the case of Type = IG_METAD_VALUE_ITEM. One of the enumIGMETADItemType Enumeration values. |
Length | Contains the number of bytes required to store the value. For ValueType = AM_TID_TXT_STRING it should indicate the number of characters in the string excluding last null character (basically the length of the string). For ValueType = AM_TID_RAW_DATA it should indicate the number of bytes that the raw data occupies. |
Value | Contains the value of the item in the case of Type = IG_METAD_VALUE_ITEM. The value is presented as an IGDataItem object. |
IsLastItem | Used only in the IGMetaDataItemAdd Event Handler. Your Event Handler should set this to True to indicate that there is no more data to be added. |
ReadOnly | Set this to True in your IGMetaDataItemAdd Event Handler to indicate that this metadata item can never be changed when the file is read in the future. In IGMetaDataItemRead and IGMetaDataItemWrite, if this is True then any changes made by your Event Handler to the metadata item will be ignored by ImageGear. |
You can transfer different non-image data using the general data structure described in this section. See Non-Image Data Storage for the TIFF, JPEG, EXIF-TIFF, EXIF-JPEG, PNG, IPTC, DCRAW, CIFF, and JPEG 2000 non-image data structure description.
It may happen that the application provides the item with the name or ID of a different type than the format filter is expecting. For example, the format filter may expect the item named SOFTWARE with text as a String, but the application provides its value as an Integer. In this case the filter will raise an error that this type of item is not expected. |
Thus, the code needed to obtain the metadata for a file is as follows:
Copy Code
|
|
---|---|
Dim page As IGPage IGCoreCtl1.License.SetSolutionName "Accusoft" IGCoreCtl1.Result.NotificationMode = IG_ERR_NO_ACTION IGCoreCtl1.AssociateComponent IGFormatsCtl1.ComponentInterface IGFormatsCtl1.Settings.MetaDataEnabled = True Dim gcp As IGGlobalParameter Object Set gcp = IGCoreCtl.CreateObject(IG_OBJ_GLOBAL_PARAM) gcp.Name = "FLTR.METADATA_FORMAT" Dim gcpvalue as IGDataItem Set gcpvalue = new IGDataItem gcpvalue.Type = IG_DATA_STRING gcpvalue.String = "binary" Set gcp.Value = gcpvalue IGCoreCtl.Settings.UpdateParamFrom gcp Set page = IGCoreCtl1.CreatePage IGFormatsCtl1.LoadPageFromFile page, "myfile.tiff", 0 . . . End Sub Private Sub IGFormatsCtl1_IGMetaDataItemRead(ByVal MetaDataItem As GearFORMATSLibCtl.IIGMetaDataItem) If MetaDataItem.Type = IG_METAD_LEVEL_START Then ' start of a new group Else If MetaDataItem.Type = IG_METAD_VALUE_ITEM Then ' a simple value ' refer to MetaDataItem.ValueType and MetaDataItem.Value Else ' end of a group End If End If End Sub |