--
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/6495d8ad-44c7-48fa-9936-e8ec687d2807o%40googlegroups.com.
import Tesseract from 'tesseract.js';
import pdfimage from 'pdf-image';
var PDFImage = pdfimage.PDFImage;
var pdfImage = new PDFImage(pdfFilePath, { convertOptions: { "-density": "196" }});
function recursiveFunction(pageIndex, numberOfPages)
{
if (pageIndex > numberOfPages) {
return;
}
pdfImage.convertPage(pageIndex).then(function (pageImage) {
Tesseract.recognize(pageImage, 'eng').then(({ data: { text } }) => {
console.log(text);
//perform other synchronous processing with the text before moving to the next page...
recursiveFunction(pageIndex, numberOfPages + 1) });
});
}
recursiveFunction(0, numberOfPages)import Tesseract from 'tesseract.js';
import pdfimage from 'pdf-image';
var PDFImage = pdfimage.PDFImage;
var pdfImage = new PDFImage(pdfFilePath, { convertOptions: { "-density": "196" }});
var acc = [];
for(var pageIndex = 0; pageIndex < numberOfPages; pageIndex++)
{
let currentPageIndex = pageIndex; //Make sure you do this!! node closures will reference the wrong pageIndex otherwise!
pdfImage.convertPage(pageIndex).then(function (pageImage) {
Tesseract.recognize(pageImage, 'eng').then(({ data: { text } }) => {
console.log(text);
//perform other processing with the text before moving to the next page...
//Save the result as a variable.
acc[currentPageIndex] = results;
});
});
} --
Job board: http://jobs.nodejs.org/
New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/6495d8ad-44c7-48fa-9936-e8ec687d2807o%40googlegroups.com.