←选择平台

DownloadDocument (DownloadDocumentOptions)方法

总结

下载的数据指定的文档ID。

语法
c#
c++
公共静态DownloadDocument (DownloadDocumentOptions选项)
vb (vb语法)公共共享函数DownloadDocument (按值传递_options_作为DownloadDocumentOptions)一样长
公共:静态Int64 DownloadDocument (DownloadDocumentOptions^选项)

参数

选项

包含文档属性的选择和下载选项来使用。这个值不能

返回值

读入的字节总数DownloadDocumentOptions.DataDownloadDocumentOptions.Stream。这可以小于请求的字节数DownloadDocumentOptions.Length如果目前许多字节不,或者零(0)如果数据的结束。

讲话

类似于UploadDocument,数据可以在块或下载。指使用文档库上传详细的信息关于如何使用这些方法和所使用的各种选项。

GetDocumentCacheInfo可以用来确定一个文档是否在缓存中并得到它的信息。

DownloadAnnotations可以用来下载文档的注释(如果有的话)。

例子

这个示例将展示如何下载文档的数据存储在缓存到一个流一次,然后使用块缓冲区数组。

c#
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Document.Writer;使用Leadtools.Document;使用Leadtools.Caching;使用Leadtools.Annotations.Engine;使用Leadtools.Ocr;使用Leadtools.Barcode;使用Leadtools.Document.Converter;公共无效DownloadDocumentExample (){vardocumentUri =Uri (“https://demo.leadtools.com/images/pdf/leadtools.pdf”);字符串documentFile1 = Path.Combine (LEAD_VARS.ImagesDir,“downloaded1.pdf”);字符串documentFile2 = Path.Combine (LEAD_VARS.ImagesDir,“downloaded2.pdf”);/ /设置一个缓存FileCache缓存=FileCache ();缓存。CacheDirectory =@“c: \ cache-dir”;字符串documentId;/ /文档加载到缓存中varloadDocumentOptions =LoadDocumentOptions ();loadDocumentOptions。缓存=缓存;使用(var文档= DocumentFactory。LoadFromUri (documentUri loadDocumentOptions)){/ /文档ID,并将其保存documentId = document.DocumentId;文档。AutoDeleteFromCache =;文档。AutoSaveToCache =;document.SaveToCache ();}/ /现在一次性下载到内存流vardownloadDocumentOptions =DownloadDocumentOptions ();downloadDocumentOptions。缓存=缓存;downloadDocumentOptions。DocumentId = DocumentId;downloadDocumentOptions。抵消= 0;downloadDocumentOptions。长度= 1;使用(var流=MemoryStream ()){downloadDocumentOptions。流=流;字节= DocumentFactory.DownloadDocument (downloadDocumentOptions);Console.WriteLine (“{0}个字节到下载流”字节);/ /保存流到一个文件中并表现出来使用(var输出= File.Create (documentFile1))stream.WriteTo(输出);Process.Start (documentFile1);}/ /下载一遍,这一次我们将缓冲区32 kdownloadDocumentOptions =DownloadDocumentOptions ();downloadDocumentOptions。缓存=缓存;downloadDocumentOptions。DocumentId = DocumentId;字节[]缓冲=字节(1024 * 32);使用(var输出= File.Create (documentFile2)){/ /抵消,我们有:抵消= 0;int字节;{downloadDocumentOptions。抵消=抵消;downloadDocumentOptions。长度= buffer.Length;downloadDocumentOptions。数据=缓冲区;downloadDocumentOptions。DataOffset = 0;字节数= (int)DocumentFactory.DownloadDocument (downloadDocumentOptions);如果(字节> 0){Console.WriteLine (“{0}下载字节缓冲区”字节);/ /下一个块+ =字节抵消;输出。写(缓冲0字节);}}(字节> 0);}Process.Start (documentFile2);/ /我们正在做,清理vardeleteFromCacheOptions =LoadFromCacheOptions ();deleteFromCacheOptions。缓存=缓存;deleteFromCacheOptions。文档Id = documentId;DocumentFactory.DeleteFromCache (deleteFromCacheOptions);}静态LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS22 \ Resources \图片”;}
需求

目标平台

Leadtools。文档Assembly
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2022领先的技术公司。保留所有权利。