0

I'm trying to open a link (from a Blazor server app) to a pdf in a new tab but with no success. The pdf isn't downloading and don't know why...is should be that simple.

Tryied different solutions. This is the code used for jsruntime solution. The other is a simple "a" tag link

await JSRuntime.InvokeAsync<object>("open", url, "_blank");

Opening a simple link is working but opening a link that downloads a pdf isn't. It's a link to a ReportingServices server with the parameter "Format=PDF".

The link is as follows: myserverURL/ReportServer/Pages/ReportViewer.aspx?%2fReportTools%2fMYREPORTNAME&rs:Format=PDF

I've saw that people are having same issue with pdfs. Open PDF in new Tab - Blazor

Does anyone know what I'm doing wrong or have a solution to this?

  • Tip: when asking for help - "it doesn't work" is not good - explain what does happen, any error messages you get, etc. We can only work from information we have, so you need to tell us. So, in this case "The PDF isn't downloading and I don't know why" only tells us what is _not happening_ - try telling us what does happen - does it open a new tab? Do you see any messages in the browser console? Does the reporting server log the request?] – Mister Magoo Apr 08 '22 at 12:22
  • Sorry but I haven't got any errors than's why I haven't put them in the question. Debugging further on I may have discovered what the issue was. Since I was opening the pdf in new tab and since the project is a Blazor Server in the console I wasn't getting any errors. When I moved to using the NavigationManager to open in same tab I was getting the error in the console and it is related to requring non secure objects within secure app. My pdf is requeste over http inside https app and I think this is why on new tab is seems to don't happen anything. – Catalin Cernea Apr 11 '22 at 06:43

0 Answers0