DocumentFactory Class (original) (raw)
Summary
Provides support for loading and creating Document objects as well as managing the global cache.
Syntax
public static class DocumentFactory
public ref class DocumentFactory sealed abstract
public final class DocumentFactory
Example
using Leadtools;
using Leadtools.Caching;
using Leadtools.Document;
public void DocumentFactoryExample()
{
var options = new LoadDocumentOptions();
using (var document = DocumentFactory.LoadFromFile(Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf"), options))
{
PrintOutDocumentInfo(document);
}
}
public void PrintOutDocumentInfo(LEADDocument document)
{
Console.WriteLine("General");
Console.WriteLine(" DocumentId:" + document.DocumentId);
if (document.Uri != null)
Console.WriteLine(" Uri:" + document.Uri);
Console.WriteLine(" Name:" + document.Name);
Console.WriteLine(" CacheStatus:" + document.CacheStatus);
Console.WriteLine(" LastCacheSyncTime:" + document.LastCacheSyncTime);
Console.WriteLine(" IsReadOnly:" + document.IsReadOnly);
Console.WriteLine(" IsLocal:" + document.IsLocal);
Console.WriteLine(" MimeType:" + document.MimeType);
Console.WriteLine(" IsEncrypted:" + document.IsEncrypted);
Console.WriteLine(" IsDecrypted:" + document.IsDecrypted);
Console.WriteLine(" UserData:" + document.UserData);
Console.WriteLine("Cache");
Console.WriteLine(" HasCache:" + document.HasCache);
Console.WriteLine(" AutoDeleteFromCache:" + document.AutoDeleteFromCache);
Console.WriteLine("Metadata");
foreach (var item in document.Metadata)
Console.WriteLine(" {0} {1}", item.Key, item.Value);
Console.WriteLine("Documents");
Console.WriteLine(" Count:" + document.Documents.Count);
foreach (var childDocument in document.Documents)
{
Console.WriteLine(" Name:" + childDocument.Name);
}
Console.WriteLine("Pages");
Console.WriteLine(" Count:" + document.Pages.Count);
for (var pageNumber = 1; pageNumber <= document.Pages.Count; pageNumber++)
{
var page = document.Pages[pageNumber - 1];
Console.WriteLine(" PageNumber:" + pageNumber);
Console.WriteLine(" OriginalPageNumber:" + page.OriginalPageNumber);
Console.WriteLine(" OriginalDocumentName:" + page.Document.Name);
Console.WriteLine(" Size:{0}", page.Size);
}
Console.WriteLine("--------");
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}