We often get questions about the following error when trying to download a generated PDF on the web:
There was an error opening this document. The selected file cannot be found.
First, check out the following topics in our User Guide to be sure you’re following our recommendations for how to generate PDF exports and distribute them on the web.
Keep in mind that ActiveReports does not handle the actual PDF download or display. It only creates the file. The download and display behavior is dictated by the Response object, the browser in the client environment, or the user’s selected PDF display software such as Adobe Reader.
The recommendations outlined in our User Guide are based on the following Microsoft support pages.
- How To Write Binary Files to the Browser Using ASP.NET and Visual Basic.NET
- How To Write Binary Files to the Browser Using ASP.NET and Visual C# .NET
The File Not Found error can occur regardless of whether you use ActiveReports to generate the PDF. But since this is an issue with so many of our customers, we’ve gathered some tips on how to avoid it.
In order to find the cause of the error, try it from another client environment to see if you can reproduce the problem. If not, check the settings.
Microsoft and Adobe Systems Support
Here are a number of solutions from Microsoft and Adobe that have worked for some of our users.
- “Internet Explorer Cannot Download” Error Message When You Use an HTTPS URL to Open an Office Document or PDF File
- Troubleshoot viewing PDF files on the web
- Acrobat / PDF files don’t display for some sites on Internet Explorer
- Acrobat Help / Display PDF in browser | Acrobat DC, Acrobat Reader DC
- Acrobat Help / Display PDF in browser | Acrobat, ReaderXI
If the problem is intermittent, check the cache settings. If the HTTP Response has Cache-Control: no-cache=”set-cookie,” see the following topic in the Microsoft support page.
If you enable caching using the @ OutputCache directive in a WebForm, try another way without that directive. See the following Microsoft support page for more information.
Internet Explorer Settings
To see whether this is the issue, in your client environment, open Internet Explorer. From the Tools menu, select Internet Options, then Security, and ensure that the security level is lower than Middle.
Firewalls and Security
If firewall functions are enabled in your client environment, temporarily disable them and see if you can still reproduce the problem.
Applications in your client environment such as security software may prevent the downloaded file from opening directly. If so, change the settings of the security application you use to see whether the behavior changes.
Browser and PDF Reader
When you send PDF data using the Response object, the browser handles downloading it, and helper applications such as Adobe Reader handle opening it. The browser and helper application versions and settings can affect the behavior. See our blog article on Microsoft Edge and PDF for one such issue.