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!

@sachinerande

I’m sorry for the delayed response. The issue with the Print button was fixed. Having code that you provided I have managed to reproduce it. Please try installing the latest version of the package 8.0.4.

In case you still experience the issue with missing pages, can you please update this sample application:
VIEWERNET-5240.ZIP (2.8 MB) so I could reproduce the issue on my side?

@vladimir.litvinchik Thanks for fixing the problem of print button doesn’t work.
Still noticed some issues now. please find below.

  1. Missing pages problem, this is still reproducible when path is set to ‘document-viewer’, please find screenshot below for changes to be done in the sample application code.
    1_viewer_missing_pages.png (154.9 KB)

  2. Similar print problem is noticed, when preload page count is set to 2. Popup indicating print pages loading stuck at “Loaded 28 of 30 pages”. I used pdf “JavaScript-30P.pdf” in the sample application given.
    Attached video to repro steps.
    2_viewer_print_problem.7z (647.7 KB)

@sachinerande

Thank you for providing the details. I have reproduced both issues and they are fixed in the latest package version 8.0.5.

Please let me know if you experience any other issues.

@vladimir.litvinchik Thanks for fixing both the issues, done quick tests - those both looks ok now.

However noticed issue mainly around performance of rendering, there are additional “p1_t.jpeg” files are created per page after all the page specific files e.g. “p1.jpeg” is rendered. Creation of these files wasn’t before in (6.x releases), and appears to add now additional wait times for actual page to be shown in UI.

I have set preload page count as 300, and doc with 250 pages took around 2:30 mins to show document in viewer. so user waits for that much time in website to load entire doc. I think something can be improved around these “t” files consuming additional time. may be doing this client side or parallelly at server side. or speed up the overall jpeg image export process, this in turn would solve both.
It would be really great if this performance issue can be addressed, as viewer appears bit slower due to the image export time taken.

@sachinerande

Thanks for the feedback. Yes t files are thumbnails. Actually thumbnails seems to be not necessary and can be replaced with actual page image. I’ll test this during next iteration and update you.

At the moment you can disable thumbnails with the following code but it will also hide thumbnails panel

builder.Services
   .AddGroupDocsViewerUI(config =>
    {
        config.EnableThumbnails = false; // Hide thumbnails
    });

The issue ID for reference is VIEWERNET-5324.

1 Like

@sachinerande

The change you proposed was integrated in version 8.0.6. Now, in image mode actual page images are used for thumbnails. The thumbnails are not generated.

The packages are already available at NuGet. Please let us know if you have any issues.

Thank you @vladimir.litvinchik, I will check 8.0.6 in few days and inform you.

1 Like