←选择平台

DocumentHistory类

总结

历史跟踪LEADDocument

语法
c#
VB
c++
[DataContractAttribute ()]公共DocumentHistory
< DataContractAttribute () >公共DocumentHistory
公共(DataContractAttribute)ref类DocumentHistory
讲话

DocumentHistory管理文档的历史记录。可以通过历史的属性LEADDocument.的内部列表DocumentHistoryItem为文档中发生的每次修改或更改添加。

的值时,启用历史跟踪自动更新真正的

这些项目可以检索、更新或清除GetItemsSetItems而且清晰的分别。

有关更多信息,请参阅Toolkit历史记录跟踪

例子

此示例启用文档的历史跟踪并显示结果。

c#
VB
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Document.Writer;使用Leadtools.Document;使用Leadtools.Caching;使用Leadtools.Annotations.Engine;使用Leadtools.Ocr;使用Leadtools.Barcode;使用Leadtools.Document.Converter;公共无效DocumentHistoryExample ()//设置缓存FileCache cache =FileCache ();缓存。CacheDirectory =@“c: \ cache-dir”//创建一个新文档varcreateOptions =CreateDocumentOptions ();常量字符串documentId =“虚拟”createOptions。Cache = Cache;createOptions。文档Id = documentId;使用vardocument = DocumentFactory.Create(createOptions))文档。Name =“虚拟”document.History.AutoUpdate =真正的文档。IsReadOnly =//显示它的历史ShowHistory (“虚拟”、文档);//确保它没有页面Debug.Assert (document.Pages。Count == 0);Debug.Assert (document.Documents。Count == 0);//添加一些页面//首先从PDF文件中添加前两页varloadOptions =LoadDocumentOptions ();loadOptions。Cache = Cache;LEADDocument childDocument = DocumentFactory。LoadFromUri (Uri (“https://demo.leadtools.com/images/pdf/leadtools.pdf”), loadOptions);childDocument。AutoDeleteFromCache =childDocument.SaveToCache ();document.Pages.Add (childDocument.Pages [0]);document.Pages.Add (childDocument.Pages [1]);//添加一个空页面vardocumentPage = document.Pages.CreatePage(leadsize . create (LEADDocument。UnitsPerInch * 8.5, LEADDocument。UnitsPerInch * 11), 300);document.Pages.Add (documentPage);//添加TIFF文件的最后2页childDocument = DocumentFactory。LoadFromUri (Uri (“https://demo.leadtools.com/images/pdf/leadtools.pdf”), loadOptions);childDocument。AutoDeleteFromCache =childDocument.SaveToCache ();document.Pages.Add (childDocument.Pages [2]);document.Pages.Add (childDocument.Pages [3]);//检查文件调试。作为sert(5 == document.Pages.Count);调试。作为sert(2 == document.Documents.Count);文档。AutoDisposeDocuments =真正的文档。AutoDeleteFromCache =document.SaveToCache ();//加载它并显示它的历史varloadFromCacheOptions =LoadFromCacheOptions ();loadFromCacheOptions。Cache = Cache;loadFromCacheOptions。文档Id = documentId;使用vardocument = DocumentFactory.LoadFromCache(loadFromCacheOptions))ShowHistory (“新增虚拟页面”、文档);//清除历史记录document.History.Clear ();//现在,从缓存中加载文档使用vardocument = DocumentFactory.LoadFromCache(loadFromCacheOptions))调试。作为sert(5 == document.Pages.Count);调试。作为sert(2 == document.Documents.Count);//删除一些页面document.Pages.RemoveAt (0);document.Pages.RemoveAt (document.Pages。计数- 1);//然后旋转另一个document.Pages [1] .Rotate (90);调试。作为sert(3 == document.Pages.Count);调试。作为sert(2 == document.Documents.Count);ShowHistory (删除和旋转虚拟页面、文档);//清理vardeleteFromCacheOptions =LoadFromCacheOptions ();deleteFromCacheOptions。Cache = Cache;deleteFromCacheOptions。documententid = documententid;DocumentFactory.DeleteFromCache (deleteFromCacheOptions);私人静态无效ShowHistory (字符串消息,LEADDocument文档)控制台。WriteLine (“历史”+消息);varitems = document.History.GetItems();foreachvar项目)控制台。WriteLine (" user:{0} timestamp:{1} comment:{2} modifyType:{3} pageNumber:{4}"项。UserId,项目。时间戳,项目。评论,项目。ModifyType item.PageNumber);
进口Leadtools进口Leadtools。编解码器进口Leadtools.Document.Writer进口Leadtools.Svg进口Leadtools。文档进口Leadtools。缓存进口Leadtools.Annotations.Engine进口Leadtools。条形码进口Leadtools。光学字符识别进口LeadtoolsDocumentExamples.LeadtoolsExamples.Common进口Leadtools.Document.Converter公共共享DocumentHistoryExample ()'设置缓存昏暗的缓存作为FileCache ()缓存。CacheDirectory =“c: \ cache-dir”创建一个新文档昏暗的createOptions作为CreateDocumentOptions ()常量documentId作为字符串“虚拟”createOptions。Cache = CachecreateOptions。文档Id = documentId使用文档作为LEADDocument = DocumentFactory.Create(createOptions)文档。Name =“虚拟”document.History.AutoUpdate =真正的文档。IsReadOnly =展示它的历史ShowHistory (“虚拟”、文档)确保它没有页数Debug.Assert (document.Pages。= 0)Debug.Assert (document.Documents。= 0)增加几页“首先从PDF文件中添加前两页昏暗的loadOptions作为LoadDocumentOptions ()loadOptions。Cache = Cache昏暗的childDocument作为LEADDocument = DocumentFactory。LoadFromUri (Uri (“https://demo.leadtools.com/images/pdf/leadtools.pdf”), loadOptions)childDocument。AutoDeleteFromCache =childDocument.SaveToCache ()document.Pages.Add (childDocument.Pages (0))document.Pages.Add (childDocument.Pages (1))添加一个空白页面昏暗的documentPage作为DocumentPage = document.Pages.CreatePage(leadsize . create (LEADDocument。UnitsPerInch * 8.5, LEADDocument。* 1), 300)document.Pages.Add (documentPage)从TIFF文件中添加最后两页childDocument = DocumentFactory。LoadFromUri (Uri (“https://demo.leadtools.com/images/pdf/leadtools.pdf”), loadOptions)childDocument。AutoDeleteFromCache =childDocument.SaveToCache ()document.Pages.Add (childDocument.Pages (2))document.Pages.Add (childDocument.Pages (3))’检查文件调试。作为sert(5 = document.Pages.调试。作为sert(2 = document.Documents.文档。AutoDisposeDocuments =真正的文档。AutoDeleteFromCache =document.SaveToCache ()结束使用“装上它,展示它的历史昏暗的loadFromCacheOptions作为LoadFromCacheOptionsloadFromCacheOptions。Cache = CacheloadFromCacheOptions。文档Id = documentId使用文档作为LEADDocument = DocumentFactory.LoadFromCache(loadFromCacheOptions)ShowHistory (“新增虚拟页面”、文档)清除历史document.History.Clear ()结束使用’现在,从缓存中加载文档loadFromCacheOptions =LoadFromCacheOptionsloadFromCacheOptions。Cache = CacheloadFromCacheOptions。文档Id = documentId使用文档作为LEADDocument = DocumentFactory.LoadFromCache(loadFromCacheOptions)调试。作为sert(5 = document.Pages.调试。作为sert(2 = document.Documents.删除一些页面document.Pages.RemoveAt (0)document.Pages.RemoveAt (document.Pages。- 1)然后旋转另一个document.Pages (1) .Rotate (90)调试。作为sert(3 = document.Pages.调试。作为sert(2 = document.Documents.ShowHistory (删除和旋转虚拟页面、文档)结束使用“打扫干净”昏暗的deleteFromCacheOptions作为LoadFromCacheOptionsdeleteFromCacheOptions。Cache = CachedeleteFromCacheOptions。documententid = documententidDocumentFactory.DeleteFromCache (deleteFromCacheOptions)结束私人共享ShowHistory(消息作为字符串、文档作为LEADDocument)控制台。WriteLine (“历史”+消息)昏暗的项目作为List(Of DocumentHistoryItem) = document.History.GetItems()每一个作为DocumentHistoryItem项目控制台。WriteLine (" user:{0} timestamp:{1} comment:{2} modifyType:{3} pageNumber:{4}"项。UserId,项目。时间戳,项目。评论,项目。ModifyType item.PageNumber)下一个结束
需求
目标平台
Leadtools。文档作为sembly
188金宝搏的网址客服|支持|联系我们|知识产权公告
©1991 - 2021领德科技有限公司版权所有。