历史跟踪LEADDocument.
[DataContractAttribute ()]公共类DocumentHistory
< DataContractAttribute () >公共类DocumentHistory
公共:(DataContractAttribute)ref类DocumentHistory
DocumentHistory管理文档的历史记录。可以通过历史的属性LEADDocument.的内部列表DocumentHistoryItem为文档中发生的每次修改或更改添加。
的值时,启用历史跟踪自动更新是真正的.
这些项目可以检索、更新或清除GetItems,SetItems而且清晰的分别。
有关更多信息,请参阅Toolkit历史记录跟踪.
此示例启用文档的历史跟踪并显示结果。
使用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();foreach(var项在项目){控制台。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)下一个结束子
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗网络查看器net
188宝金博怎么下载
支持的平台上
.NET、Java、Android和iOS/macOS程序集
C API/ c++类库
HTML5 JavaScript库
您的邮件已发送给技术支持!应该有人联系!如果你的事情很紧急,请回来聊天。
聊天时间:
周一至周五,美国东部时间上午8:30至下午6:00
感谢您的反馈!
请再次填写表格,开始新的聊天。
所有代理目前都离线。
聊天时间:
星期一至星期五
美国东部时间上午8:30 -下午6点
如需与我们联系,请填写此表格,我们将通过电子邮件与您联系。
