Im running the below code and getting this error,
import { axios } from "@pipedream/platform";
import PDFParser from "pdf2json";
export default defineComponent({
async run({ steps, $ }) {
const pdfParser = new PDFParser();
pdfParser.on("pdfParser_dataError", errData => console.error(errData.parserError));
pdfParser.on("pdfParser_dataReady", pdfData => {
const text = pdfData.formImage.Pages.reduce((acc, page) => {
return acc + page.Texts.reduce((accText, textItem) => {
// Decode URI component and replace any additional encoding specific to pdf2json
const decodedText = decodeURIComponent(textItem.R[0].T).replace(/\\'/g, "'");
return accText + decodedText + " ";
}, "");
}, "");
console.log(text); // This will log the extracted text to the Pipedream logs
return text; // This will return the extracted text as the step output
});
pdfParser.loadPDF("/tmp/data.pdf");
},
});