A single file viewer in ASP.NET MVC

almost all is well now (something was corrupted on my end with the client files). The only problem I’m experiencing is what looks great in your viewer, doesn’t play out nicely when printed. please see the images

image.png (137.1 KB)
image.png (77.3 KB)

this is consistent across various printers. setting margin to zero in the print dialogue almost makes it fit, but I can’t make the client change that all the time anyway

I am using PDFmetamorphosis to do the PDF conversion. To summarize, the PDF displays and downloads perfectly, but prints poorly from your viewer.

thank you!

@xyz999xyz

Could you please attach a sample file to investigate the issue?

Community Pricing-APs_2021-08-6–13-41-24.pdf (140.5 KB)

this looks great when viewing and downloading the PDF

@xyz999xyz

Thank you for attaching the sample file. The HTML that Viewer is producing is not optimized for printing. Possibly printing PDF would look better see print-pdf.png (286.4 KB). Printing PDF instead of HTML does require some changes see this commit for more details. Please let us know if it works for you.

I’ll take a look, but it’s a bit ridiculous to not support printing a PDF properly on the box.

@xyz999xyz

The issue with opening file by specifying file path in query string has been fixed. Now you can specify file or url query string parameter to open file from storage or download file into a storage and open it by URL.

To update UI @groupdocs.examples.angular/viewer package to the latest version call npm update "@groupdocs.examples.angular/viewer" from the client folder. All the changes can be found in this commit.

@xyz999xyz

We do have plans to print PDF instead of HTML in the future versions as PDF is more suitable for printing comparing to HTML.

little bit confused here, how is this different than using file= or f= ?

thanks!

@xyz999xyz

The file= or f= does the same thing now so you don’t need the custom code to support f= in the client (Angular) app code. In the previous version of the client app code the file= parameter worked incorrectly and instead of opening the file the app tried to download the file. At the moment you have two options to use

  • pass file={FILE_PATH} query string parameter to open file from storage
  • pass url={FILE_URL} query string parameter to download, save file in a storage and open it

In general, you don’t need to change anything that worked before with f= parameter if you’re OK with it.

I just updated to the newest version to support your commit. Anything new regarding this? A better way?

would this be better?

@xyz999xyz7

The parameters file={FILE_PATH} and url={FILE_URL} are working as it described in my previous comment.