Quiero almacenar el valor del finallext en una variable e imprimirlo en un cuadro de texto, ¿cómo puedo hacerlo? ¿¿¿¿Puede alguien ayudarme con esto????
Tesseract.recognize( '../uploads/scanned-images/<?php echo $image_name; ?>', 'eng', { logger: m => console.log(m) } ).then(({ data: { text } }) => { var extractedText = text; var finalText = extractedText.replace(/[^0-9A-Za-z]/gi, ''); alert(finalText); })Puede devolver algunas variables en then() como esta.
const finalText = await Tesseract.recognize( '../uploads/scanned-images/<?php echo $image_name; ?>', 'eng', { logger: m => console.log(m) } ).then(({ data: { text } }) => { let extractedText = text; let finalText = extractedText.replace(/[^0-9A-Za-z]/gi, ''); // alert(finalText); return finalText; }); alert(finalText); PD : debe usar async function .