2

im trying to load pdf using react-native-pdf it works for most of the pdfs, but for some it throws an error "load pdf failed" i am getting the pdf in base64 state and pass it to react-native-pdf.

ive looked everywhere and cant find a fix. any idea how to solve this ?

my code:

setSource({uri:`data:application/pdf;base64,${documentBinary}`, cache:true})

 <Pdf
                              style={styles.pdf}
                              source={source}
                              onLoadComplete={(numberOfPages, filePath)=>{
                                   console.log(`number of pages: ${numberOfPages}`);
                                   console.log(`cache path: ${filePath}`)
                                   
                                   if(currentDocument != null){
                                        cachedFilesMap.setItem(currentDocument.docNum, filePath)
                                   }
                              }}
                              onPageChanged={(page,numberOfPages)=>{
                                   console.log(`current page: ${page}`);
                              }}
                              onError={(error)=>{
                                   console.log(error);
                              }}
                              onPressLink={(uri)=>{
                                   console.log(`Link presse: ${uri}`)
                              }}
                         />

thnx

eyal gromzin
  • 155
  • 2
  • 11
  • Hi. Why did you delete your question at https://stackoverflow.com/questions/70893060/algorithm-to-find-highest-percentage-of-combination ? It was a great problem! I know stackoverflow can be intimidating sometimes, with other users trying to close questions or downvoting or commenting with links to "please read how to ask a good questions", etc, but please don't by shy, the problem you asked about was very interesting :) – Stef Jan 28 '22 at 12:12

0 Answers0