Hi, We recently moved to 8.0.7 viewer, so far its working fine. Just observed following random problem.
Issue
Wrong page no is displayed initially when the document is opened in viewer. Issue is observed when our web server is doing too much and it returns the result to /get-pages api call slowly.
e.g. when document is opened, it shows 31 page no initially and on every subsequent refresh or opening of the document it shows same 31 page no. In viewer actually by default first page is shown.
This gives misinterpretation to user as he see page no 1 but it’s shown 31.
On scroll page no is reset to what we see, so it works normal there after.
To reproduce the issue, please refer following program.cs file i have.
(Note - explicit delay introduced by using middleware for “viewer-api/get-page” so you could reproduce)
using GroupDocs.Viewer.UI.Core.Configuration;
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddGroupDocsViewerUI(options =>
{
options.EnableFileName = false;
options.EnablePresentation = false;
options.EnableHeader = false;
options.EnableFileBrowser = true;
options.EnableDownloadPdf = false;
options.EnableSearch = false;
options.EnableLanguageSelector = false;
options.EnableFileUpload = false;
options.PreloadPages = 300;
options.StaticContentMode = false;
options.EnablePrint = true;
options.RenderingMode = RenderingMode.Image;
});
builder.Services.AddControllersWithViews()
.AddRazorRuntimeCompilation()
.AddGroupDocsViewerSelfHostApi(options =>
{
options.SetViewerType(GroupDocs.Viewer.UI.Core.ViewerType.Jpg);
options.SetLicensePath("GroupDocs.Viewer.lic");
})
.AddLocalStorage("./Files")
.AddLocalCache("./Cache");
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.Use(async (context, next) =>
{
if (context.Request.Path.ToString().Contains("viewer-api/get-page"))
{
await Task.Delay(1500);
}
await next(context);
});
app.UseRouting()
.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapGroupDocsViewerUI(options =>
{
options.UIPath = "/viewer";
options.ApiEndpoint = "/viewer-api";
});
endpoints.MapGroupDocsViewerApi(options =>
{
options.ApiPath = "/viewer-api";
});
});
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
app.Run();
Once you open the document, just refresh again and see if you have the page no 31 appears in browser. Use any file sufficiently large with more than 100 pages.
Could be some page no initialization logic runs early before all pages are loaded from backend over get-page call.
see image produced this problem. on multiple refresh it only shows the same page no initially.
image.jpg (190.6 KB)
Packages in csproj file
<PackageReference Include="GroupDocs.Viewer.UI" Version="8.0.7" />
<PackageReference Include="GroupDocs.Viewer.UI.Api.Local.Cache" Version="8.0.7" />
<PackageReference Include="GroupDocs.Viewer.UI.SelfHost.Api" Version="8.0.7" />
<PackageReference Include="GroupDocs.Viewer.UI.Api.AzureBlob.Storage" Version="8.0.7" />
<PackageReference Include="GroupDocs.Viewer.UI.Api.Local.Storage" Version="8.0.7" />