Unable to print all pages of large documents

Hi, We use GroupDocs Viewer for .NET with asp.net core 8 application. Viewer type jpg has been set.
When I render pdf document, it correctly renders as images per page.

However for some pdfs clicking on print button, only shows few pages/blank pages/random pages etc. but doesn’t show all pages.
After digging more into this, when overall size of all the rendered images of pdf is higher more than 60 mb or so, clicking on print button print window only shows fewer pages available for printing.
Issue is seen with both chrome and edge. it doesn’t appear browser issue.

Download the sample PDF “sample_pdf_printing_problem_1.pdf” which can be used to reproduce the problem. (use the download button on the github page)

For this pdf - overall size of all rendered images with default quality set of 90 is 87mb. when we set quality to 40, overall image folder size reduces to 39 mb, and then only all pages are available for printing.

This is blocker for us as we can’t print some of large pdfs.

@sachinerande

Thank you for sharing the file. When viewer type is jpg or png we print images instead of PDF, so it could be an issue with printing the images. Images are printed to protect text from being copied from PDF.

In you use case do you need to print images or PDF files?

@vladimir.litvinchik : we would like to protect our docs and so we need only print images only as said on Groupdocs viewer for .NET - original pdfs returned to browser on clicking Print button - Free Support Forum - groupdocs.com

we are happy with what jpg viewer is doing now, but why only few images are available for printing for large documents? Images are well rendered, but when clicked on print button, print windows opens but not all pages are available there. need a fix for this issue only.

@sachinerande

Got it, we’ll take a look what may cause this issue and update you.

1 Like

@vladimir.litvinchik could you update on this please? we are blocked on lot of complaints on this problem.

@sachinerande

Unfortunately, I do not have any updates at the moment. It is in my schedule for this week. As soon as I check it I will let you know.

@vladimir.litvinchik : Thanks for letting me know, we will await on this.

@vladimir.litvinchik : This might help to troubleshoot/fix the problem.
I tried replacing in “main.js” file
looks like printing with
e.contentWindow.document.execCommand("print",!1) has a problem.

I tried following and it loads all pages in print preview window.
e.contentWindow.print()

so effectively I tried replacing and it appear to work.
printFrame(e){try{e.focus(),e.contentWindow.document.execCommand("print",!1)}catch(i){e.contentWindow.print()}
by
printFrame(e){try{e.focus(),e.contentWindow.print()}catch(i){e.contentWindow.document.execCommand("print",!1)}

May be execCommand has been deprecated.

@sachinerande

Thank you for sharing the solution. At the time when I was writing the code I have read about the deprecation but it worked well, so I decided to keep execCommand. Now I see that is wasn’t the best decision.

I’ll double check it and publish new package version.

Thanks again!

1 Like

@sachinerande

I have applied the fix that you have suggested. Print works well for a large files on my end.

I have published the fix - NuGet Gallery | GroupDocs.Viewer.UI 6.0.30.

Please note that there is also version that has the following pattern 8.0.x. This version uses UI from GroupDocs.Viewer App. See README for more details on configuration.

Package version 8.0.x is still using PDF for printing. I’ going to fix this so print feature is working the same as in 6.0.x version.

Hi @vladimir.litvinchik : Thanks, I have updated the viewer libraries to latest as in 6.x lane. Just did a quick test on the problematic docs and it works. We will run through formal test cycle as have upgraded other libs as well, to check any regression on updates.

@sachinerande

Got it, thanks. In case you get a chance please let me know if it works as expected now.

1 Like

@Vladimir_Litvinchik
Just to update - This is working as expected now. Thanks!

@sachinerande

Great! Thank you for the feedback!

Hi @vladimir.litvinchik : just to be sure, fixes on 6.x are on 8.x. could you please notify when this will be done, so we can upgrade packages to latest version 8.x.

@sachinerande

The changes at the moment only in 6.x version. Will update you when the changes will be moved into 8.x. I believe that it will be next week.

Please note that there are slight public API changes in 8.x compared to 6.x.

Thanks @Vladimir_Litvinchik, next week should be ok.

could you please share the link to set up groupdocs as per new package on lane 8 so we can do that in our code. may be link to some migration guide from v6 to v8. Thanks!

We are at following version now.

	<PackageReference Include="GroupDocs.Viewer" Version="24.12.0" />
	<PackageReference Include="GroupDocs.Viewer.UI" Version="6.0.30" />
	<PackageReference Include="GroupDocs.Viewer.UI.Api.Local.Cache" Version="6.0.5" />
	<PackageReference Include="GroupDocs.Viewer.UI.SelfHost.Api" Version="6.0.32" />
	<PackageReference Include="GroupDocs.Viewer.UI.Api.AzureBlob.Storage" Version="6.0.6" />

@sachinerande

  1. To setup 8.x update package versions from 6.x to the latest available 8.x. For example you can just do dotnet add package GroupDocs.Viewer.UI and for other packages to install the latest version.

  2. Check for the compilation errors in your Program.cs or the class that you use for application composition. In most cases we have changed the property names.

  3. Test your application.

In case you have any issues with updating to the latest version please let us know.

1 Like

Thanks @vladimir.litvinchik : I was able to test upgrade it locally, would there be posibility to hide the file name appearing in thumbnail please? may be if this can be fixed with the merge from 6 to 8 if possible, to avoid wait times.

I have raised another thread related to this.

image.png (10.9 KB)

@sachinerande

Yes, this will be fixed within the next update.