Unique identifier of this document.
public string DocumentId { get; }
Public ReadOnly Property DocumentId() As String
Get
public:
property String^ DocumentId
{
String^ get()
}
public String getDocumentId()
The unique identifier of this document.
This value is set by the framework when the document is initialized. The ID is important when using the document with the cache system and is the only value needed to re-construct completely the document from the cache. The current implementation of the Documents library will pass the document ID as the "regionName" value for all cache operations.
This example will show how to use DocumentId to save a document to the cache and then reload it then delete it from the cache.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;
using Leadtools.Documents;
using Leadtools.Caching;
using Leadtools.Annotations.Core;
using Leadtools.Forms.Ocr;
using Leadtools.Barcode;
public static void DocumentIdExample()
{
var cache = GetCache();
var policy = new CacheItemPolicy();
policy.AbsoluteExpiration = DateTime.Now + new TimeSpan(0, 0, 10);
policy.SlidingExpiration = new TimeSpan(0, 0, 10);
var options = new LoadDocumentOptions();
options.Cache = cache;
options.CachePolicy = policy;
string documentId = null;
using (var document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options))
{
document.AutoDeleteFromCache = false;
documentId = document.DocumentId;
document.SaveToCache();
}
using (var document = DocumentFactory.LoadFromCache(cache, documentId))
{
if (null != document)
{
document.AutoDeleteFromCache = true;//will be deleted
}
}
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.Forms.DocumentWriters
Imports Leadtools.Svg
Imports Leadtools.Documents
Imports Leadtools.Caching
Imports Leadtools.Annotations.Core
Imports Leadtools.Barcode
Imports Leadtools.Forms.Ocr
<TestMethod()>
Public Shared Sub DocumentIdExample()
Dim cache As ObjectCache = GetCache()
Dim policy As CacheItemPolicy = New CacheItemPolicy()
policy.AbsoluteExpiration = DateTime.Now + New TimeSpan(0, 0, 10)
policy.SlidingExpiration = New TimeSpan(0, 0, 10)
Dim options As LoadDocumentOptions = New LoadDocumentOptions()
options.CachePolicy = policy
options.Cache = cache
Dim documentId As String = Nothing
Using document As Document = DocumentFactory.LoadFromFile(Path.Combine(ImagesPath.Path, "Leadtools.pdf"), options)
document.AutoDeleteFromCache = False
documentId = document.DocumentId
document.SaveToCache()
End Using
Using document As Document = DocumentFactory.LoadFromCache(cache, documentId)
If document IsNot Nothing Then
'will be deleted
document.AutoDeleteFromCache = True
End If
End Using
End Sub
Products |
Support |
Feedback: DocumentId Property (Document) - Leadtools.Documents |
Introduction |
Help Version 19.0.2017.3.22
|
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.