ReadMetadataItems(string,int) Method (original) (raw)

Summary

Reads metadata from the specified file.

Syntax

public: IDictionary<String^,String^>^ ReadMetadataItems( String^ _fileName_, int _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.

Example

using Leadtools; using Leadtools.Codecs; using Leadtools.ImageProcessing; using Leadtools.ImageProcessing.Color; using Leadtools.Svg; public void ReadMetadataItemsExample() { // The source file string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "random.dxf"); using (var codecs = new RasterCodecs()) { bool isMetadataItemsSupported; using (var fileInfo = codecs.GetInformation(srcFileName, false)) { Debug.WriteLine("Format {0}", (int)fileInfo.Format); //Check if Metadata supported for the specified file format. isMetadataItemsSupported = RasterCodecs.MetadataItemsSupported(fileInfo.Format); Debug.WriteLine("isMetadataItemsSupported {0}", isMetadataItemsSupported); } if (isMetadataItemsSupported) { IDictionary<string, string> metadata = null; try { //Read Metadata Items metadata = codecs.ReadMetadataItems(srcFileName, 1); } catch (RasterException ex) { Debug.WriteLine(ex.Message); } Debug.WriteLine("Items count {0}", metadata.Count); foreach (var item in metadata) { //Key Ex: RasterCodecs.FileMetadataKeyAuthor; Debug.WriteLine("{0}: {1}", item.Key, item.Value); } } } } static class LEAD_VARS { public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; }

Leadtools.Codecs Assembly

CompactFile(Stream,Stream,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(Stream,Stream,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

CompactFile(string,string,int,int,bool,int,int,bool,int,CodecsSavePageMode,bool,bool) Method

CompactFile(string,string,int,int,bool,long,int,bool,long,CodecsSavePageMode,bool,bool,bool) Method

StartCompress(int,int,int,RasterByteOrder,RasterViewPerspective,int,byte[],int,int,CodecsCompression,CodecsCompressDataCallback) Method