#1
Posted
:
Monday, January 7, 2019 7:56:24 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 post(s)
The Leadtools SDK allows for a document's metadata information to be accessed by using a few simple commands.
Below are a few relevant links to our LEADTOOLS Online Documentation that will elaborate further on the example below.
https://www.leadtools.co...orking-with-markers.htmlhttps://www.leadtools.co...s-readmetadataitems.htmlhttps://www.leadtools.co...astermarkermetadata.htmlhttps://www.leadtools.co...l/rastertagmetadata.htmlhttps://www.leadtools.co...stercommentmetadata.htmlThe code below shows how to check to see if the file provided supports housing metadata and outputs the contained metadata if it does contain any.
Code:
string srcFile = @"TODO: Modify this file path";
using (var rasterCodecs = new RasterCodecs())
using (var fileInfo = rasterCodecs.GetInformation(srcFile, false))
{
Console.WriteLine("Format: {0}", fileInfo.Format);
// Check if metadata is supported for the specified file format
bool isMetadataItemsSupported = RasterCodecs.MetadataItemsSupported(fileInfo.Format);
Console.WriteLine("isMetadataItemsSupported: {0}", isMetadataItemsSupported);
if (isMetadataItemsSupported)
{
// Read metadata items
IDictionary<string, string> metadata = null;
try
{
metadata = rasterCodecs.ReadMetadataItems(srcFile, 1);
}
catch (Exception ex)
{
Console.WriteLine("Unable to read metadata: {0}", ex.message);
}
if (metadata != null)
{
Console.WriteLine("Items count: {0}", metadata.Count);
foreach (var item in metadata)
// Key ex: RasterCodecs.FileMetadataKeyAuthor
Console.WriteLine("{0}: {1}", item.Key, item.Value);
}
}
}
Console.ReadLine();
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.