Home > OS >  Local PDF not loading iOS react native pdf
Local PDF not loading iOS react native pdf

Time:12-22

I want to load my local PDF in PDF view so i am using this plugin for that https://www.npmjs.com/package/react-native-pdf

So below is my code

let finalURL = require('../../html/html/pdf/VIVJOA-Full-Prescribing-Information.pdf')
const source = {
 uri: finalURL,
 cache: true,
};


<Pdf
    trustAllCerts={false}
    source={source}
    style={styles.pdf}  
  />

When i run above code in iOS it give me error like Warning: Failed prop type: Invalid prop source supplied to Pdf, expected one of type [string, number]..

Any idea how can i solve this?

CodePudding user response:

add only url in the source:

let finalURL = require('../../html/html/pdf/VIVJOA-Full-Prescribing-Information.pdf')


<Pdf
    trustAllCerts={false}
    source={finalURL}
    style={styles.pdf}  
  />
  • Related