c#
VB
c++
Java
创建一个新的空虚拟文档。
公共共享函数创建(按值传递选项作为CreateDocumentOptions)作为LEADDocument
公共:静态LEADDocument^创建(CreateDocumentOptions^选项)
公共静态文档创建(CreateDocumentOptions选项)
选项
在创建文档时使用的选项。不能零。
新创建的文档。
创建一个新的空虚拟文档准备充满页面从其他文档。
这种方法会增加项目的关键“创建”、“访问”和“修改”元数据值等于当前日期和时间。新创建的LEADDocument对象将有一个空的列表页面。它可以由用户填充。
的成员选项使用如下:
| 成员 | 描述 |
|---|---|
| 缓存和UseCache | 用于确定新创建的文件将被保存在缓存中。 |
| CachePolicy |
如果使用缓存:复制到新创建的文档和用于确定当文档及其项目从缓存中清除。 |
| MimeType |
复制到新创建的文档MimeType成员。这个值可以零但建议你将它设置为文档的MIME类型,因为它将在保存文档时使用。使用MIME类型中定义的常数之一常量类。在虚拟文件的情况下,这个值可以离开零。 |
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Document.Writer;使用Leadtools.Document;使用Leadtools.Caching;使用Leadtools.Annotations.Engine;使用Leadtools.Ocr;使用Leadtools.Barcode;使用Leadtools.Document.Converter;公共无效DocumentFactoryCreateExample (){var缓存= GetCache ();/ /创建一个新的文档varcreateOptions =新CreateDocumentOptions ();createOptions。缓存=缓存;字符串documentId =零;使用(LEADDocument文档= DocumentFactory.Create (createOptions)){文档。Name =“虚拟”;/ /应该0页面和文档System.Diagnostics.Debug.Assert (document.Pages。数= = 0);System.Diagnostics.Debug.Assert (document.Documents。数= = 0);/ /添加页面从PDF文件1和2LoadDocumentOptions loadOptions =新LoadDocumentOptions ();loadOptions。缓存=缓存;LEADDocument childDocument = DocumentFactory.LoadFromFile (Path.Combine (LEAD_VARS.ImagesDir“Leadtools.pdf”),loadOptions);/ /不处理子文档,但将其保存在缓存中/ /这是可选的,在这个例子中,因为我们将尝试重新加载代码父文档/ /从缓存中——和孩子文档应该在缓存中childDocument.SaveToCache ();/ /添加页面document.Pages.Add (childDocument.Pages [0]);document.Pages.Add (childDocument.Pages [1]);/ /添加一个空白页vardocumentPage = document.Pages.CreatePage (LeadSizeD.Create (LEADDocument。LEADDocument UnitsPerInch * 8.5。UnitsPerInch * 11), 300);document.Pages.Add (documentPage);/ /添加页面从TIF文件3和4childDocument = DocumentFactory.LoadFromFile (Path.Combine (LEAD_VARS.ImagesDir“ocr1.tif”),loadOptions);/ /还保存在缓存中childDocument.SaveToCache ();/ /添加页面document.Pages.Add (childDocument.Pages [0]);document.Pages.Add (childDocument.Pages [0]);/ /应该有5页,2文档(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= = 5);System.Diagnostics.Debug.Assert (document.Documents。数= = 2);/ /告诉父文档处理任何的孩子当父母处理的文档文档。AutoDisposeDocuments =真正的;/ /显示该文档的信息,应该说5页Console.WriteLine (“原始文档信息”);PrintOutDocumentInfo(文档);/ /保存,父文档到缓存document.SaveToCache ();/ /告诉所有文件不删除自己从缓存中文档。AutoDeleteFromCache =假;/ /保存ID所以我们可以加载它documentId = document.DocumentId;}/ /现在,从缓存中加载文档varloadFromCacheOptions =新LoadFromCacheOptions ();loadFromCacheOptions。缓存=缓存;loadFromCacheOptions。文档Id = documentId;使用(LEADDocument文档= DocumentFactory.LoadFromCache (loadFromCacheOptions)){/ /应该有5页,2文档(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= = 5);System.Diagnostics.Debug.Assert (document.Documents。数= = 2);/ /显示该文档的信息,应该还说5页Console.WriteLine (“从缓存加载信息”);PrintOutDocumentInfo(文档);/ /删除第一页document.Pages.RemoveAt (0);/ /删除最后一页document.Pages.RemoveAt (document.Pages。数- 1);/ /应该有3页,2文档(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= = 3);System.Diagnostics.Debug.Assert (document.Documents。数= = 2);Console.WriteLine (“在删除前2页”);PrintOutDocumentInfo(文档);/ /从缓存中删除本文档及其所有的孩子当我们处理文档。AutoDeleteFromCache =真正的;}}公共无效PrintOutDocumentInfo (LEADDocument文档){Console.WriteLine (“一般”);Console.WriteLine (DocumentId:“+ document.DocumentId);如果(文档。Uri ! =零)Console.WriteLine (”Uri:“+ document.Uri);Console.WriteLine (名称:“+ 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 (“用户数据:“+ document.UserData);Console.WriteLine (“缓存”);Console.WriteLine (”HasCache:“+ document.HasCache);Console.WriteLine (”AutoDeleteFromCache:“+ document.AutoDeleteFromCache);Console.WriteLine (“元数据”);foreach(var项在document.Metadata)Console.WriteLine (“{0}{1}”,项目。键,item.Value);Console.WriteLine (“文件”);Console.WriteLine (“数:”+ document.Documents.Count);foreach(varchildDocument在document.Documents){Console.WriteLine (名称:“+ childDocument.Name);}Console.WriteLine (“页面”);Console.WriteLine (“数:”+ document.Pages.Count);为(varpageNumber = 1;pageNumber < = document.Pages.Count;pageNumber + +){var文档页面=。页面[pageNumber - 1];Console.WriteLine (”PageNumber:“+ pageNumber);Console.WriteLine (”OriginalPageNumber:“+ page.OriginalPageNumber);Console.WriteLine (”OriginalDocumentName:“+ page.Document.Name);Console.WriteLine (“大小:{0}”,page.Size);}Console.WriteLine (“- - - - - - - - - -”);}公共ObjectCache GetCache (){/ /创建一个LEADTOOLS FileCache对象varcacheDir = Path.Combine (LEAD_VARS.ImagesDir,“缓存”);如果(Directory.Exists (cacheDir))Directory.Delete (cacheDir真正的);Directory.CreateDirectory (cacheDir);var缓存=新FileCache ();缓存。缓存Directory = cacheDir;返回缓存;}静态类LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;}静态类LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;}
进口Leadtools进口Leadtools.Codecs进口Leadtools.Document.Writer进口Leadtools.Svg进口Leadtools.Document进口Leadtools.Caching进口Leadtools.Annotations.Engine进口Leadtools.Barcode进口Leadtools.Ocr进口LeadtoolsDocumentExamples.LeadtoolsExamples.Common进口Leadtools.Document.Converter公共子DocumentFactoryCreateExample ()昏暗的缓存作为ObjectCache = GetCache ()创建一个新文档昏暗的createOptions作为新CreateDocumentOptions ()createOptions。缓存=缓存昏暗的documentId作为字符串=没有什么使用文档作为LEADDocument = DocumentFactory.Create (createOptions)文档。Name =“虚拟”'应该0页面和文档System.Diagnostics.Debug.Assert (document.Pages。数= 0)System.Diagnostics.Debug.Assert (document.Documents。数= 0)“添加页面从PDF文件1和2昏暗的loadOptions作为新LoadDocumentOptions ()loadOptions。缓存=缓存昏暗的childDocument作为LEADDocument = DocumentFactory.LoadFromFile (Path.Combine (ImagesPath.Path“Leadtools.pdf”),loadOptions)不处理子文档,但将其保存在缓存中“这是可选的,在这个例子中,因为我们将尝试重新加载代码父文档“从缓存中——和孩子文档应该在缓存中childDocument.SaveToCache ()“现在添加页面document.Pages.Add (childDocument.Pages (0))document.Pages.Add (childDocument.Pages (1))添加一个空白页昏暗的documentPage作为Leadtools.Document。文档Page = document.Pages.CreatePage(LeadSizeD.Create(LEADDocument.UnitsPerInch * 8.5, LEADDocument.UnitsPerInch * 11), 300)document.Pages.Add (documentPage)“添加页面从TIF文件3和4childDocument = DocumentFactory.LoadFromFile (Path.Combine (ImagesPath.Path“Ocr.tif”),loadOptions)也将其保存在缓存中childDocument.SaveToCache ()“现在添加页面document.Pages.Add (childDocument.Pages (2))document.Pages.Add (childDocument.Pages (3))“应该有5页和2文件(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= 5)System.Diagnostics.Debug.Assert (document.Documents。数= 2)“告诉父文档处理任何的孩子当父母处理的文档文档。AutoDisposeDocuments =真正的显示该文档的信息,应该说5页Console.WriteLine (“原始文档信息”)PrintOutDocumentInfo(文档)“现在保存,父文档到缓存document.SaveToCache ()并告诉所有文件不删除自己从缓存中文档。AutoDeleteFromCache =假“拯救ID所以我们可以加载它documentId = document.DocumentId结束使用“现在,从缓存中加载文档昏暗的loadFromCacheOptions作为新LoadFromCacheOptionsloadFromCacheOptions。缓存=缓存loadFromCacheOptions。文档Id = documentId使用文档作为LEADDocument = DocumentFactory.LoadFromCache (loadFromCacheOptions)“应该有5页和2文件(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= 5)System.Diagnostics.Debug.Assert (document.Documents。数= 2)显示该文档的信息,应该还说5页Console.WriteLine (“从缓存加载信息”)PrintOutDocumentInfo(文档)“删除第一页document.Pages.RemoveAt (0)删除最后一页document.Pages.RemoveAt (document.Pages。数- 1)“应该有3页和2文件(PDF和TIF)System.Diagnostics.Debug.Assert (document.Pages。数= 3)System.Diagnostics.Debug.Assert (document.Documents。数= 2)Console.WriteLine (“在删除前2页”)PrintOutDocumentInfo(文档)“从缓存中删除本文档及其所有的孩子当我们处理文档。AutoDeleteFromCache =真正的结束使用结束子公共共享子PrintOutDocumentInfo (按值传递文档作为LEADDocument)Console.WriteLine (“一般”)Console.WriteLine (DocumentId:“+ document.DocumentId)如果不没有(document.Uri)然后Console.WriteLine (”Uri:“+ document.Uri.ToString ())其他的Console.WriteLine (名称:“+ document.Name)结束如果Console.WriteLine (”CacheStatus:“+ document.CacheStatus.ToString ())Console.WriteLine (”LastCacheSyncTime:“+ document.LastCacheSyncTime.ToString ())Console.WriteLine (”IsReadOnly:“+ document.IsReadOnly.ToString ())Console.WriteLine (”IsLocal:“+ document.IsLocal.ToString ())Console.WriteLine (MimeType:“+ document.MimeType)Console.WriteLine (”IsEncrypted:“+ document.IsEncrypted.ToString ())Console.WriteLine (”IsDecrypted:“+ document.IsDecrypted.ToString ())如果不没有(document.UserData)然后Console.WriteLine (“用户数据:“+ document.UserData.ToString ())结束如果Console.WriteLine (“缓存”)Console.WriteLine (”HasCache:“+ document.HasCache.ToString ())Console.WriteLine (”AutoDeleteFromCache:“+ document.AutoDeleteFromCache.ToString ())Console.WriteLine (“元数据”)为每一个项作为KeyValuePair (字符串,字符串)在document.MetadataConsole.WriteLine (“{0}{1}”,项目。键,item.Value)下一个Console.WriteLine (“文件”)Console.WriteLine (“数:”+ document.Documents。数.ToString ())为每一个childDocument作为LEADDocument在document.DocumentsConsole.WriteLine (名称:“+ childDocument.Name)下一个Console.WriteLine (“页面”)Console.WriteLine (“数:”+ document.Pages。数.ToString ())为pageNumber作为整数= 1来document.Pages。数昏暗的页面作为Leadtools.Document。文档Page = document.Pages(pageNumber - 1)Console.WriteLine (”PageNumber:“+ pageNumber.ToString ())Console.WriteLine (”OriginalPageNumber:“+ page.OriginalPageNumber.ToString ())Console.WriteLine (”OriginalDocumentName:“+ page.Document.Name)Console.WriteLine (“大小:{0}”page.Size.ToString ())下一个Console.WriteLine (“- - - - - - - - - -”)结束子公共共享函数GetCache ()作为ObjectCache“创建一个LEADTOOLS FileCache对象昏暗的cacheDir作为字符串= Path.Combine (ImagesPath.Path“缓存”)如果Directory.Exists (cacheDir)然后Directory.Delete (cacheDir真正的)结束如果Directory.CreateDirectory (cacheDir)昏暗的缓存作为新FileCache ()缓存。缓存Directory = cacheDir返回缓存结束函数
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等
谢谢你的反馈!
请填写表单重新开始一个新的聊天。
所有代理目前离线。
聊天时间:
周一-周五
早上8:30 - 6点
联系我们请填写这张表格,我们将通过电子邮件联系你。
