Unable to print all pages of large documents

@vladimir.litvinchik Great, Thank you!

@sachinerande

You’re welcome!

@sachinerande

There are two updates in the latest version of GroupDocs.Viewer.UI 8.0.2

Print

The feature where images are printed instead of PDF in image mode was moved from version 6.0.x to 8.0.x.

File name

This feature was fixed and now hides file name from top bar and thumbnails pane.

Also, you can set the file name using your implementation of IFileNameResover interface and registering a service:

builder.Services.AddTransient<IFileNameResolver, MyFileNameResolver>();

public class MyFileNameResolver : IFileNameResolver
{
    public Task<string> ResolveFileNameAsync(string file)
    {
        return Task.FromResult($"Custom file name for {file}");
    }
}


To get the changes update you GroupDocs.Viewer.UI and GroupDocs.Viewer.UI.* packages to the latest 8.0.2 version.

The complete list of changes can be found in the release notes

Please let us know if you have any questions.

Hi @vladimir.litvinchik Thanks for updating. I am noticing following problems with the upgrade.
We have PreloadPageCount set to 300
Viewing document of 98 pages ( < 300)

Issues observed -

  • When loaded pdf in the viewer, it renders all pages, sometimes few are missing either in thumbnail or it’s actual page. (need to scroll or click on print button to load them, and sometimes it doesn’t load altogether.)
    Here is the screenshot for “sample_pdf_printing_problem_1.pdf” that was shared with this ticket.
    image.png (44.1 KB)

  • Simple scroll operation sometimes shows scrolling 5-6 pages at a time as that appears in page number field. (may be double check the page no fix is correctly applied)

  • Clicking print button - following loading pages popup always loads clicking on print button, even though pages are already rendered, and it takes a while to finish. (may be making calls to backend again)
    image.png (6.0 KB)

@sachinerande

Thank you for reporting this issues, we’ll analyze them and update you. The issue ID for reference is VIEWERNET-5240.

@vladimir.litvinchik : just wanted to check how it’s progressing and any updates. thanks.

@sachinerande

I’m sorry for the delayed response. The issues you have listed are planned to be fixed in March as soon as I have any updates I’ll let you know.

@vladimir.litvinchik Great, thank you for update.

@sachinerande

You’re welcome!

@sachinerande

In the latest version of GroupDocs.Viewer.UI, we’ve resolved the issue related to printing documents in image mode.

Previously, we used direct links to the document pages. Now, we’re using the URL.createObjectURL() method, which caches the pages and prevents them from being reloaded when the Print button is clicked. The printing process now works in three stages:

  1. Generates any pages that haven’t been created yet
  2. Loads any pages that are not already cached
  3. Sends the document to print

Unfortunately, I wasn’t able to reproduce the issue where some pages appear to be missing. I’d appreciate your help in verifying whether the issue still exists on your side.

Additionally, I couldn’t reproduce the Simple scroll issue either. Could you please share an animation or video demonstrating the problem so we can analyze it further?

See also v25.3 release notes for all the changes in this release.

Hi @vladimir.litvinchik
Thanks, I have updated to following version now,
image.png (16.2 KB)

Issue - some pages missing or blank/white.
Just investigated this appears to be when custom viewer paths has been set as follows, which was working in previous release (6.*).

Many 404s in debug console for various page urls. (get-thumb, get-page). looks like it still uses “viewer-api” instead “document-viewer-api”

https://localhost:5176/viewer-api/get-thumb?file=sample_pdf_printing_problem_1.pdf&page=28
https://localhost:5176/viewer-api/get-page?file=sample_pdf_printing_problem_1.pdf&page=234

        endpoints.MapGroupDocsViewerUI(options =>
        {
            options.UIPath = "/document-viewer";
            options.ApiEndpoint = "/document-viewer-api";
        });

        endpoints.MapGroupDocsViewerApi(options =>
        {
            options.ApiPath = "/document-viewer-api";
        });

When I set this to it works and pages now loads without whitespace.

        endpoints.MapGroupDocsViewerUI(options =>
        {
            options.UIPath = "/viewer";
            options.ApiEndpoint = "/viewer-api";
        });

        endpoints.MapGroupDocsViewerApi(options =>
        {
            options.ApiPath = "/viewer-api";
        });

Further observations to this new release. (after using /viewer)

  • Print button doesn’t work, nothing happens. no console logs or network calls/errors in browser console. (both on edge and chrome)
    I have following settings in my viewer.
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);
    })
    .AddLocalStorage("./Files")
    .AddLocalCache("./Cache");

please try with above settings, if doesn’t work, will try to create video. (although there might be some upload size restriction, i think on this forum)

@sachinerande

Thank you for the feedback, I’ll look into this issues ASAP. Will update you when I have any information.

@vladimir.litvinchik Sure, thank you!