Error processing SSI file
LEADTOOLS Image File Support (Leadtools.Codecs assembly)

Show in webframe

ReadMetadataItems(String,Int32) Method








A String containing the name of the image file from which the metadata should be read.
1-based index to the page number from which the metadata should be read.
Reads metadata from the specified file.
Syntax
public Dictionary<string,string> ReadMetadataItems( 
   string fileName,
   int pageNumber
)
'Declaration
 
Public Overloads Function ReadMetadataItems( _
   ByVal fileName As String, _
   ByVal pageNumber As Integer _
) As Dictionary(Of String,String)
'Usage
 
Dim instance As RasterCodecs
Dim fileName As String
Dim pageNumber As Integer
Dim value As Dictionary(Of String,String)
 
value = instance.ReadMetadataItems(fileName, pageNumber)
public Dictionary<string,string> ReadMetadataItems( 
   string fileName,
   int pageNumber
)
 function Leadtools.Codecs.RasterCodecs.ReadMetadataItems(String,Int32)( 
   fileName ,
   pageNumber 
)

Parameters

fileName
A String containing the name of the image file from which the metadata should be read.
pageNumber
1-based index to the page number from which the metadata should be read.

Return Value

Returns a Dictionary. of key, value pairs for the file metadata items.
Remarks

Possible values for the metadata keys:

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Color
Imports Leadtools.Drawing
Imports Leadtools.Svg

      
Public Shared Sub ReadMetadataItemsExample()
   ' The source file
   Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "random.dxf")
   Using codecs As New RasterCodecs()
      Dim isMetadataItemsSupported As Boolean

      Using fileInfo As CodecsImageInfo = codecs.GetInformation(srcFileName, False)
         Console.WriteLine("Format {0}", CInt(fileInfo.Format))
         'Check if Metadata supported for the specified file format.
         isMetadataItemsSupported = RasterCodecs.MetadataItemsSupported(fileInfo.Format)
         Console.WriteLine("isMetadataItemsSupported {0}", isMetadataItemsSupported)
      End Using

      If isMetadataItemsSupported Then
         Dim metadata As Dictionary(Of String, String) = Nothing

         Try
            'Read Metadata Items
            metadata = codecs.ReadMetadataItems(srcFileName, 1)
         Catch ex As RasterException
            Console.WriteLine(ex.Message)
         End Try

         Console.WriteLine("Items count {0}", metadata.Count)
         For Each item As KeyValuePair(Of String, String) In metadata
            'Key Ex: RasterCodecs.FileMetadataKeyAuthor;
            Console.WriteLine("{0}: {1}", item.Key, item.Value)
         Next
      End If
   End Using

End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
using Leadtools.Svg;

      
public static void ReadMetadataItemsExample()
{
   // The source file
   string srcFileName = Path.Combine(ImagesPath.Path, "random.dxf");
   using (var codecs = new RasterCodecs())
   {
      bool isMetadataItemsSupported;

      using (var fileInfo = codecs.GetInformation(srcFileName, false))
      {
         Console.WriteLine("Format {0}", (int)fileInfo.Format);
         //Check if Metadata supported for the specified file format.
         isMetadataItemsSupported = RasterCodecs.MetadataItemsSupported(fileInfo.Format);
         Console.WriteLine("isMetadataItemsSupported {0}", isMetadataItemsSupported);
      }

      if (isMetadataItemsSupported)
      {
         Dictionary<string, string> metadata = null;

         try
         {
            //Read Metadata Items
            metadata = codecs.ReadMetadataItems(srcFileName, 1);
         }
         catch (RasterException ex)
         {
            Console.WriteLine(ex.Message);
         }

         Console.WriteLine("Items count {0}", metadata.Count);
         foreach (var item in metadata)
         {
            //Key Ex: RasterCodecs.FileMetadataKeyAuthor;
            Console.WriteLine("{0}: {1}", item.Key, item.Value);
         }
      }
   }
}
Requirements

Target Platforms

See Also

Reference

RasterCodecs Class
RasterCodecs Members
Overload List

Error processing SSI file