I want to extract text from the pdf file I selected in React native. Although I tried many ways like pdf2Json, pdf parse, they all contain errors. All running with node and giving fs error.
for pdf parse, MyCode:
const fs = require("fs");
const parser = require("pdf-parse");
const file = fs.readFile("./sample.pdf");
parser(file).then(function (data) {
console.log(data.text);
});
It works when I run my code as node Parser.js, but I can't use it in react native. How can I run this code with a button onpress? Is there anyone who can help?