gets my request by an "id" and respond it by returning pdf file from mydatabase coresponding id
Loading
gets my request by an "id" and respond it by returning pdf file from mydatabase coresponding id
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mahesh ChandRank #1 · 393.3K reputationPosted Nov 27, 2023, 9:43 AM EST
Here are the steps:
Hope it helps!
Kip Hackman61 reputationPosted Jan 3, 2024, 3:29 PM EST
From the information that you provided it sounds like you are looking for a document caching system. You can use the LEADTOOLS Document SDK to create your own caching system to store and manage documents.
https://www.leadtools.com/help/sdk/dh/to/document-toolkit-and-caching.html
Each document will have its own unique identifier that will be used to distinguish between the different documents.
public 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(@"C:\LEADTOOLS22\Resources\Images\Leadtools.pdf"), options)) { document.AutoDeleteFromCache = false; documentId = document.DocumentId; document.SaveToCache(); } var loadFromCacheOptions = new LoadFromCacheOptions(); loadFromCacheOptions.Cache = cache; loadFromCacheOptions.DocumentId = documentId; using (var document = DocumentFactory.LoadFromCache(loadFromCacheOptions)) { if (null != document) { document.AutoDeleteFromCache = true;//will be deleted } } } public ObjectCache GetCache() { // Create a LEADTOOLS FileCache object var cacheDir = Path.Combine(@"C:\LEADTOOLS22\Resources\Images\cache"); if (Directory.Exists(cacheDir)) Directory.Delete(cacheDir, true); Directory.CreateDirectory(cacheDir); var cache = new FileCache(); cache.CacheDirectory = cacheDir; return cache; } public void PrintOutDocumentInfo(LEADDocument document) { Console.WriteLine("General"); Console.WriteLine(" DocumentId:" + document.DocumentId); if (document.Uri != null) Console.WriteLine(" Uri:" + document.Uri); Console.WriteLine(" Name:" + document.Name); Console.WriteLine(" CacheStatus:" + document.CacheStatus); Console.WriteLine(" LastCacheSyncTime:" + document.LastCacheSyncTime); Console.WriteLine(" IsReadOnly:" + document.IsReadOnly); Console.WriteLine(" IsLocal:" + document.IsLocal); Console.WriteLine(" MimeType:" + document.MimeType); Console.WriteLine(" IsEncrypted:" + document.IsEncrypted); Console.WriteLine(" IsDecrypted:" + document.IsDecrypted); Console.WriteLine(" UserData:" + document.UserData); Console.WriteLine("Cache"); Console.WriteLine(" HasCache:" + document.HasCache); Console.WriteLine(" AutoDeleteFromCache:" + document.AutoDeleteFromCache); Console.WriteLine("Metadata"); foreach (var item in document.Metadata) Console.WriteLine(" {0} {1}", item.Key, item.Value); Console.WriteLine("Documents"); Console.WriteLine(" Count:" + document.Documents.Count); foreach (var childDocument in document.Documents) { Console.WriteLine(" Name:" + childDocument.Name); } Console.WriteLine("Pages"); Console.WriteLine(" Count:" + document.Pages.Count); for (var pageNumber = 1; pageNumber <= document.Pages.Count; pageNumber++) { var page = document.Pages[pageNumber - 1]; Console.WriteLine(" PageNumber:" + pageNumber); Console.WriteLine(" OriginalPageNumber:" + page.OriginalPageNumber); Console.WriteLine(" OriginalDocumentName:" + page.Document.Name); Console.WriteLine(" Size:{0}", page.Size); } Console.WriteLine("--------"); }Anandu G NathRank #681 · 3.5K reputationPosted Jan 3, 2024, 11:02 PM EST
Refer Below Article,
https://www.c-sharpcorner.com/blogs/consume-web-api-in-asp-net-using-http-client-with-basic-authentication
https://www.c-sharpcorner.com/article/introduction-to-asp-net-web-api/
https://dotnettutorials.net/course/asp-net-web-api/
https://www.dotnettricks.com/learn/webapi/content-negotiation-in-asp-net-web-api
https://www.youtube.com/watch?v=0pcM6teVdKk