Welcome to the JavaScript feedback portal. We’re happy you’re here! If you have feedback on how to improve the JavaScript, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

Hello,

I am currently building a web app where the user will be able to view PDF files. I reproduced the same problems in Angular, and JS.

I followed the steps in this tutorial so I have a ASP .NET Core web service that can serve PDF files.

https://www.syncfusion.com/kb/11063/how-to-create-pdf-viewer-web-service-in-net-core-3-0-and-above

Loading a PDF in the viewer works, when the file exists on my server.

However, I have 2 problems, which may be a bug or something I have to handle in my code. I put both problems in one image because I wasn't able to add 2 screenshots.


Problem 1-  If I ask for a file that doesn't exist, the server sends the error message to the browser (because the file doesn't exist). However, the browser's PDF viewer stays in a "loading" state and never display the error. I believe the PDFViewer should display the error message automatically,  like it does when you have a 404 or 500 HTTP Error. If I have to handle the error in my client code (javascript), what should I do?
 Is there an HTTP error I have to use?

By the way, my C# server code sends back this to the client ... just like in the example :


return Content(jsonObject["document"] + " is not found");

2- If I change my PDFViewer's document's quickly (2-3 times in a second), the pdfviewer control hangs forever. I have to kill my browser's tab. You can see in my screenshot that, just before the browser hangs, the server reply 3 to my browser. I don't know why it's like this, but it always display 3 before crashing.


Is there a way I can program the PDFViewer to quit or timeout when a pdf file isn't loaded after X seconds? Or is there a way I can respond in any way to this?
 I don't mind displaying a message "You're too fast!" to the user.
 (or simply destroy the page/component and retry)

At first, I tough the problem was angular data binding. So I did a vue app which calls the PDFViewer's unload and load methods when I click on a listview item. I reproduced the same problem.

By the way, my PDF files are big. So you may need big PDF files to reproduce this.

Thanks,

Pascal