download and open pdf not working on Chrome and Safari?

0
0

Hi,

C# on Visual Stidio 2022, Wisej 2.2.46

I have the following code:

MemoryStream ms = new MemoryStream();
using (FileStream file = new FileStream(file_name, FileMode.Open, FileAccess.Read)) file.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
Application.DownloadAndOpen(“_blank”, ms, “Meaningfull name.pdf”);

It works perfect on Edge, Opera, Firefox

On Chrome I get:

404 – File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

 

On iPhone 16 and MacBook it just won’t open.

 

Please advice

  • You must to post comments
0
0

Hi Julie,

Yes, the behaviour is reproducible in 3.5.17.8. Just run it directly from Visual Studio, On Edge and on Chrome.

New project, on Page1 add a button, and on button click write:

private void button1_Click(object sender, EventArgs e)
{
string file_name = “C:\\Temp\\test.pdf”;
MemoryStream ms = new MemoryStream();
using (FileStream file = new FileStream(file_name, FileMode.Open, FileAccess.Read)) file.CopyTo(ms);
ms.Seek(0, SeekOrigin.Begin);
Application.DownloadAndOpen(“_blank”, ms,”test.pdf”);
}

You must have c:\temp\test.pdf file.

I attached the full project and test.pdf  🙂

  • Julie
    • Julie
    • Mar 21, 2025 - 6:30 pm
    I tried with your test project and I cannot reproduce- works fine for me on edge and chrome. Perhaps it’s an issue with your computer-try clearing your browser cache, and restarting your computer
  • Adrian Zagar
    After some tests, I discovered that the problem was determined by Chrome extension Adobe Acrobat 25.3.1.1. After disabling it, it works. Maybe the same on iPhone/Mac OS? In the meantime, I switch to Wisej PdfViewer that seems to work all times.
  • You must to post comments
0
0

Can you try with Wisej 3.5.17 (most recent version) and see if that resolves the issue?

If that does not fix it, please include a reproducible test case.

Julie

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.