question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't open pdf after download

See original GitHub issue

Configurations of my pdf

CONTENT-TYPE | application/octet-stream

My code

const downloadPdf = (uri: string, nome: string): void => {
    setLoading(true)
    const {config, fs} = RNFetchBlob
    const PictureDir = fs.dirs.DownloadDir
    const options = {
      fileCache: true,
      addAndroidDownloads: {
        useDownloadManager: true,
        notification: true,
        title: nome,
        path: `${PictureDir}/${nome}`,
      },
      appendExt: 'pdf',
    }
    config(options)
      .fetch('GET', uri, {
        // Accept: 'application/json',
        // 'Content-Type': 'multipart/form-data,octet-stream',
        'Content-Type': 'multipart/form-data',
      })
      .then((_) => {
        Snackbar.show({
          text: 'Download realizado com sucesso!',
          backgroundColor: colors.silverTree,
        })
      })
      .catch((_) => {
        Snackbar.show({
          text: 'Error ao realizar download!',
          backgroundColor: colors.valencia,
        })
      })
      .finally(() => setLoading(false))
  }

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

17reactions
gorbatenkovcommented, Oct 1, 2020

Was able to fix it by adding android:requestLegacyExternalStorage=“true” to my manifest file. Based on this https://medium.com/@sriramaripirala/android-10-open-failed-eacces-permission-denied-da8b630a89df

6reactions
LouisJScommented, Sep 1, 2020

Hi @adaerodriguez,

I’m doing exactly this in my app. It works well on iOS ! However, on Android, it goes to a black screen on

RNFetchBlob.android.actionViewIntent(res.path(), mimeType || 'application/pdf');

And come back to the app. If i touch my notification on my phone, it redirects me to the file, which has been successfully downloaded on my phone.

Would you know what causes this issue ?

RN: 0.63.2 RN-Fetch-Blob: 0.12.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't open PDF - Adobe Support
Download the PDF and open it in Acrobat Reader or Acrobat · Right-click (Windows) or control-click (Mac OS) the link to the PDF...
Read more >
6 Fixes to Try When Adobe Acrobat Reader Can't Open PDF ...
6 Fixes to Try When Adobe Acrobat Reader Can't Open PDF Files on Windows · Right-click on the Windows Start button and select...
Read more >
PDF Won't Open? 3 Quick Ways to Fix 'can't open pdf' Error on ...
Your PDF files are not compatible with your PDF reader. Your PDF is infected by a virus. ; Run Adobe Reader. Select Help...
Read more >
PDF won't open? How to Fix PDF Files not Opening Error
1. Install the latest version of Adobe Acrobat · 2. Disable the Protected mode at startup · 3. Download a third-party universal file...
Read more >
Effective Methods to Fix "Cannot Open PDF" Error
Unsupported file type: This is the most common reason you cannot open PDF. · Outdated Acrobat or Adobe Reader: · PDF files created...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found