OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to convert PDF to base64 in react-native-document-picker?

  • Thread starter Thread starter Tamas Farago
  • Start date Start date
T

Tamas Farago

Guest
I would like to convert the response of react-native-document-picker to base64 format. As a response I get the Uri of the file but unfortunately no base64.

this is my code:

Code:
const openDocumentFile = async () =>{
        try {
            const results = await DocumentPicker.pickMultiple({
              type: [DocumentPicker.types.pdf],
              readContent: true
            });
            for (const res of [results]) {
           
              console.log(res)
          
            };
                
          } catch (err) {
            if (DocumentPicker.isCancel(err)) {
            } else {
              throw err;
            }
          }
    } ```

<p>I would like to convert the response of react-native-document-picker to base64 format. As a response I get the Uri of the file but unfortunately no base64.</p>
<p>this is my code:</p>
<pre><code>const openDocumentFile = async () =>{
try {
const results = await DocumentPicker.pickMultiple({
type: [DocumentPicker.types.pdf],
readContent: true
});
for (const res of [results]) {

console.log(res)

};

} catch (err) {
if (DocumentPicker.isCancel(err)) {
} else {
throw err;
}
}
} ```


</code></pre>
 

Latest posts

Z
Replies
0
Views
1
zuegelwagen
Z
Top