Wednesday, August 6, 2014

samsung galaxy s 4 - How to open PDF from Notification bar and fix "Cannot open file" error?


I have searched and searched for a solution to this problem, please help. I am using a Samsung Galaxy S4 with Android 4.2.2 along with the Chrome browser.



Steps to replicate:



  1. Navigate to: http://www.buzzbuzzbingo.com/Holidays/Halloween_Images/

  2. Click "Download and Print" to start download of PDF file.

  3. Notice notification that says "Starting downloading..."

  4. Open notification bar and see that the download has completed.

  5. Click the downloaded PDF file and receive "Cannot open file" error message and the notification bar closes.


Long clicking the downloaded PDF does not offer options for choosing which app to open the file. I have installed Adobe Reader and using that to navigate to the downloaded file will open the file just fine. Same with Polaris Office. I would like to be able to open the PDF from the notification bar. Alternatively if I could view the PDF directly in Chrome, that would be acceptable.



Answer




It's a combination of a PDF and a browser issue. Some PDFs work fine while others do not across different browsers.


Downloading the PDF you mentioned, here are the results using different browsers:



  • Chrome: Cannot open PDF from notification

  • Boat Browser: Cannot open PDF from notification

  • Dolphin: Can open PDF from notification


Downloading a different PDF from another site, here are the results using different browsers:



  • Chrome: Can open PDF from notification


  • Boat Browser: Can open PDF from notification

  • Dolphin: Can open PDF from notification


UPDATE 2013-10-11: According to Scott's findings, this is a PDF issue. The Content-Type header of the problematic PDF is application/x-download, while the working PDF is application/pdf.


If you control the server which is serving these PDFs, you can switch the Content-Type header to allow it to open in all browsers. PHP example:


In PHP this was previously broken when sending:


 header('Content-Type: application/x-download');

Switch this to this header to work:


 header('Content-Type: application/pdf');

No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...