From 81bf04c678e31a6e6b41a6a3f5ce8ee3ad4c7cdf Mon Sep 17 00:00:00 2001 From: Balearica Date: Sat, 17 Sep 2022 20:35:55 -0700 Subject: [PATCH] Updated download-pdf example for node to use new savePDF option --- examples/node/download-pdf.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/node/download-pdf.js b/examples/node/download-pdf.js index 2f7ed24..6a82216 100755 --- a/examples/node/download-pdf.js +++ b/examples/node/download-pdf.js @@ -12,10 +12,9 @@ console.log(`Recognizing ${image}`); const worker = await createWorker(); await worker.loadLanguage('eng'); await worker.initialize('eng'); - const { data: { text } } = await worker.recognize(image); + const { data: { text, pdf } } = await worker.recognize(image, {savePDF: true}); console.log(text); - const { data } = await worker.getPDF('Tesseract OCR Result'); - fs.writeFileSync('tesseract-ocr-result.pdf', Buffer.from(data)); + fs.writeFileSync('tesseract-ocr-result.pdf', Buffer.from(pdf)); console.log('Generate PDF: tesseract-ocr-result.pdf'); await worker.terminate(); })();