Start uploading a document to the cache.
public static Uri BeginUpload(UploadDocumentOptions options)
Public Shared Function BeginUpload(ByVal options As UploadDocumentOptions) As System.Uri
public:static System::Uri^ BeginUpload(UploadDocumentOptions^ options)
public static URI beginUpload(UploadDocumentOptions options) options
Options to use with the new document. This value cannot be null.
The temporary URL for the uploaded document.
This method will throw an exception if neither LoadDocumentOptions.Cache nor Cache was setup with a valid cache object.
BeginUpload, UploadDocument and AbortUploadDocument can be used to upload a document in chunks to the cache used by this DocumentFactory. After the document is uploaded, you can use LoadFromUri to create a Document object from the data.
This method returns a URL with a special LEAD cache scheme to indicate a loaded document. This URL can be detected using IsUploadDocumentUri helper method.
Refer to Uploading Using the Documents Library for detailed information on how to use these methods and the various options used.
using Leadtools;using Leadtools.Codecs;using Leadtools.Forms.DocumentWriters;using Leadtools.Svg;using LeadtoolsExamples.Common;using Leadtools.Documents;using Leadtools.Caching;using Leadtools.Annotations.Core;using Leadtools.Forms.Ocr;using Leadtools.Barcode;public static void DocumentFactoryBeginUploadExample(){var cache = GetCache();const int bufferSize = 1024 * 32;var buffer = new byte[bufferSize];var fileName = Path.Combine(ImagesPath.Path, "Leadtools.pdf");Uri uploadUri = null;using (var reader = File.OpenRead(fileName)){var uploadOptions = new UploadDocumentOptions();uploadOptions.Cache = cache;uploadUri = DocumentFactory.BeginUpload(uploadOptions);int bytes;do{bytes = reader.Read(buffer, 0, bufferSize);if (bytes > 0){DocumentFactory.UploadDocument(cache, uploadUri, buffer, 0, bytes);}}while (bytes > 0);}var options = new LoadDocumentOptions();options.Cache = cache;using (var document = DocumentFactory.LoadFromUri(uploadUri, options)){PrintOutDocumentInfo(document);}}
Imports LeadtoolsImports Leadtools.CodecsImports Leadtools.Forms.DocumentWritersImports Leadtools.SvgImports Leadtools.DocumentsImports Leadtools.CachingImports Leadtools.Annotations.CoreImports Leadtools.BarcodeImports Leadtools.Forms.OcrImports LeadtoolsDocumentsExamples.LeadtoolsExamples.Common'Imports LeadtoolsDocumentsExamples.LeadtoolsExamples.CommonPublic Shared Sub DocumentFactoryBeginUploadExample()Dim cache As ObjectCache = GetCache()Const bufferSize As Integer = 1024 * 32Dim buffer() As Byte = New Byte(bufferSize - 1) {}Dim fileName As String = Path.Combine(ImagesPath.Path, "Leadtools.pdf")Dim uploadUri As Uri = NothingUsing reader As FileStream = File.OpenRead(fileName)Dim uploadOptions As New UploadDocumentOptions()uploadOptions.Cache = cacheuploadUri = DocumentFactory.BeginUpload(uploadOptions)Dim bytes As IntegerDobytes = reader.Read(buffer, 0, bufferSize)If bytes > 0 ThenDocumentFactory.UploadDocument(cache, uploadUri, buffer, 0, bytes)End IfLoop While bytes > 0End UsingDim options As New LoadDocumentOptions()options.Cache = cacheUsing document As Leadtools.Documents.Document = DocumentFactory.LoadFromUri(uploadUri, options)PrintOutDocumentInfo(document)End UsingEnd Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
