Gets all the metadata tags stored in a file.
#include "l_bitmap.h"
L_LTFIL_API L_INT L_ReadFileMetaDataItems(pszFile, pMetaData, pLoadOptions)
Character string that contains the input file name.
Pointer to a L_FILEMETADATAITEMS structure that will be filled with the metadata items from the source image file. When this data is no longer needed pass it to the L_FreeFileMetaDataItems function to free the allocated memory.
Pointer to optional extended load options. Pass NULL to use the default load options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
You must free the data allocated with this function using the L_FreeFileMetaDataItems function.
The file referenced by pszFile
must be a file format that supports XMP. For example PNG, PDF, JPEG, TIFF, SVG, DOC, DOCX, XLS, XLSX, PPT and PPTX.
To determine if a file format supports metadata tags, use L_FileMetaDataItemsSupported.
The metadata tags returned by this function are different than data associated with TIF tags. The TIF tags associate metadata with an integer identifier (the tag number). The metadata returned by this function is identified by a string identifier (the key).
Also, the metadata in TIF tags can take various forms (numbers, strings, rationals, arrays of numbers). The metadata value returned by this function can take only one form: a string. Of course, a number can also be returned by this function, but the number is returned as a string. And it is up to you to convert the string value back to a number.
Win32, x64, Linux.
This example demonstrates the functions related to MetaData items. Checks MetaData support, reads MetaData items, prints MetaDataItems data, and then frees allocated MetaData items.
L_INT PrintFileMetaData(L_TCHAR* pFileName)
{
L_INT nRet;
L_BOOL bIsMetaDataSupported;
FILEINFO FileInfo = { 0 };
//Get file information
nRet = L_FileInfo(pFileName, &FileInfo, sizeof(FILEINFO), 0, NULL);
if(nRet != SUCCESS)
return nRet;
//Check if MetaData supported for the specified file format.
bIsMetaDataSupported = L_FileMetaDataItemsSupported(FileInfo.Format);
if(bIsMetaDataSupported)
{
L_FILEMETADATAITEMS MetaDataItems = { 0 };
MetaDataItems.uStructSize = sizeof(L_FILEMETADATAITEMS);
//Read MetaData Items
nRet = L_ReadFileMetaDataItems(pFileName, &MetaDataItems, NULL);
if(nRet != SUCCESS)
return nRet;
wprintf(L"Items count %u\n", MetaDataItems.uCount);
for(L_UINT i = 0; i < MetaDataItems.uCount; i++)
{
//Print Key & Value for each item in MetaDataItems
const L_FILEMETADATAITEM* item = &MetaDataItems.pItems[i];
//key Ex: L_FILEMETADATAKEY_TITLE
wprintf(L"%s: %s\n", item->Key, item->Value);
}
//Free MetaData Items
L_FreeFileMetaDataItems(&MetaDataItems);
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document