2
For reducing the loading time| DocumentUltimate
Question asked by Sandeep Mohanadasan - 4/2/2018 at 2:42 AM
Answered
It is taking almost 10 seconds to load the document at initial time.Could you please suggest any performance improvement technique on loading document viewer
 
 
Note:I am using Ver 3.13.0.0 ,i am not able access ComponentRenderer.

Below is my code

----------------------------------------------------------
@using GleamTech.AspNet.Mvc
@using GleamTech.DocumentUltimate
@using GleamTech.DocumentUltimate.AspNet
@using GleamTech.DocumentUltimate.AspNet.UI

<!DOCTYPE html>

@{

var documentViewer = new DocumentViewer
{
Height = 900,
Document = ViewBag.URL//URL passed from controller

};

}
<html>
<head>
<title>Document Viewer</title>
@this.RenderHead(documentViewer)
</head>
<body>
@this.RenderBody(documentViewer)
</body>
</html>

6 Replies

Reply to Thread
0
Cem Alacayir Replied
Employee Post
From the docs:
 
Upon first view, internally DocumentViewer will convert the source document to PDF (used for "Download as Pdf" and also for next conversion step) and then to XPZ (a special web-friendly format which DocumentViewer uses to actually render documents in the browser). So in this case the user will see "please wait awhile..." message in the viewer for a few seconds. These generated PDF and XPZ files will be cached and upon consecutive page views, the document will be served directly from the cache so the user will see the document instantly on second viewing. When you modify the source document, the cached files are invalidated so your original document and the corresponding cached files are always synced automatically. Note that it's also possible to pre-cache documents via DocumentCache.PreCacheDocument method (e.g. when your user uploads a document), see General Samples for more information.
0
Sandeep Mohanadasan Replied
Hi cem,
Thanks for your input
0
Siddharth Singh Replied
Hi I am facing error of slow loading of PDF files. I don't need download option, so disabled it. Also I don't need file in cache because I'm using encrypted files and they render every time.
How could I increase the loading time. Please help me!
0
new user Replied
I second request for option not to have/keep PDF. it's takes time to convert and space in hard drive.
If client request PDF I can always use convert class to make one.

0
John_S Replied
I am also looking for a solution to this problem. I am on version 5.6.0 and sometimes loading documents with many pages makes the user wait on the waiting dialog for a long time. Has there been a solution to this yet?
0
Cem Alacayir Replied
Employee Post Marked As Answer
Upon first view, internally DocumentViewer will convert the source document (e.g. a docx file) to PDF (used for "Download as Pdf" and also for next conversion step) and then to XPZ (a special web-friendly format which DocumentViewer uses to actually render documents in the browser). So in this case the user will see "please wait awhile..." message in the viewer for a few seconds. These generated PDF and XPZ files will be cached and upon consecutive page views, the document will be served directly from the cache so the user will see the document instantly on second viewing. When you modify the source document (e.g. edit a docx file in Word), the cached files are invalidated so your original document and the corresponding cached files are always synced automatically.

So your user will wait for a specific document only once. When he opens the same document next time, there will be no waiting. Note that same document means document having the same cache key.
You should be careful if you are using DocumentSource and DocumentInfo class and providing your own uniqueId (the unique identifier that will be used for generating the cache key for this document). For instance, it can be an ID from your database table or a simple file name; you just need to make sure this ID varies for each different document so that they are cached correctly. For example for files on disk, we internally use a string combination of file extension, file size and file date for uniquely identifying them, this way cache collisions do not occur and we can resuse the cached file even if the file name before extension is changed (file1.docx and file2.docx have same cache key because it's still the same document according to file extension, file size and file date ). 

Note that it's also possible to pre-cache documents via 
DocumentCache.PreCacheDocument method (e.g. when your user uploads a document), see Pre-caching documents for more information. This way your user will not wait even on first view because you had already converted and cached it before.

Reply to Thread