L_EnumFileTags

#include "l_bitmap.h"

L_LTFIL_API L_INT L_EnumFileTags (pszFile, uFlags, pfnCallback, pUserData, pLoadOptions)

Enumerates all the TIFF tags in a file. See the Comments section below for a list of formats which support TIFF tags.

Parameters

L_TCHAR* pszFile

Character string containing the name of the file in which to enumerate the tags.

L_UINT uFlags

Flags parameter. Reserved for future use. Pass 0.

ENUMTAGSCALLBACK pfnCallback

Callback function for enumerating each tag. Use the function pointer as the value of this parameter.L_EnumFileTags calls this callback function for each tag. The callback function must adhere to the function prototype described in the ENUMTAGSCALLBACK callback function.

L_VOID* pUserData

Void pointer that you can use to pass one or more additional parameters that the callback function needs.To use this feature, assign a value to a variable or create a structure that contains as many fields as you need. Then, in this parameter, pass the address of the variable or structure, casting it to L_VOID *. The callback function, which receives the address in its own pUserData parameter, can cast it to a pointer of the appropriate data type to access your variable or structure.

pLOADFILEOPTION pLoadOptions

Pointer to optional extended load options. Pass NULL to use the default load options.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

For multipage TIFF files, you can enumerate the tags from a particular page. Specify the page number on which to enumerate the tags using the pLoadOptions structure. For more information, refer to the LOADFILEOPTION structure.

This function enumerates the standard TIFF tags and the user tags. Standard TIFF tags are less than 32767. User TIFF tags are usually between 32768 and 65535.

To read a tag value, call L_ReadFileTag.

Note that if ENUMTAGSCALLBACK returns a value other than SUCCESS, L_EnumFileTags will stop enumerating the tags and return the value returned by ENUMTAGSCALLBACK as its return value.

Do not attempt to use the L_DeleteTag function to delete tags from inside an ENUMTAGSCALLBACK callback function. If you want to delete tags that you enumerate, use ENUMTAGSCALLBACK to add the tags to a list. Upon returning from L_EnumFileTags, you can delete all the tags from the list.

For general information about TIFF tags, refer to Implementing TIFF Comments and Tags.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Functions

Topics

Example

This example will read all the user tags from page 1 of "file.tif".

L_INT EXT_CALLBACK EnumFileTagCallback(L_UINT16  uTag, 
                                       L_UINT16  uType, 
                                       L_UINT32  uCount, 
                                       L_VOID  * pUserData) 
{ 
   UNREFERENCED_PARAMETER(pUserData); 
   L_TCHAR s[100]; 
   wsprintf(s, TEXT("Tag = %d, Type = %d, Count = %d"), uTag, uType, uCount); 
   MessageBox(NULL, s, TEXT("EnumFileTagCallback"), MB_OK); 
   return SUCCESS; 
} 
 
L_INT EnumFileTagsExample(HWND hWnd) 
{ 
   /* Enumerate the tags */ 
   UNREFERENCED_PARAMETER(hWnd); 
   return L_EnumFileTags(MAKE_IMAGE_PATH(TEXT("OCR1.tif")), 0, EnumFileTagCallback, NULL, NULL); 
} 

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

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.