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.
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?
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.
@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)}
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.
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.
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.
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!
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.
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.
Test your application.
In case you have any issues with updating to the latest version please let us know.
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.