Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, January 7, 2019 7:56:24 AM(UTC)
Christopher

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.html
https://www.leadtools.co...s-readmetadataitems.html
https://www.leadtools.co...astermarkermetadata.html
https://www.leadtools.co...l/rastertagmetadata.html
https://www.leadtools.co...stercommentmetadata.html

The 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();


File Attachment(s):
simpleDocInfo_20.zip (228kb) downloaded 61 time(s).
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.041 seconds.