Skip to content

Pdf File not found #238

Description

@mamta-deswal

I'm using react-native-fs for downloading the pdf and saving it.

let url = 'http://samples.leanpub.com/thereactnativebook-sample.pdf';

const getPdfName = () => {
return url.split('/').pop();
};

RNFS.downloadFile({
fromUrl: url,
toFile: ${RNFS.DocumentDirectoryPath}/${getPdfName()},
}).promise.then(r => {
let path = ${RNFS.DocumentDirectoryPath}/${getPdfName()};
setFilePath(path);
});

const resourceType = 'file';
const resources = {
file: 'thereactnativebook-sample.pdf',
};

<PDFView
fadeInDuration={250.0}
style={styles.pdfStyle}
resource={resources[resourceType]}
resourceType={resourceType}
onLoad={() => console.log(PDF rendered from ${resourceType})}
onError={error => console.log('Cannot render PDF', error)}
/>

Getting error 'Pdf file not found. While code works fine with URL-type resources.

Version:-
"react": "18.1.0",
"react-native": "0.70.0",

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions