Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set output types #197

Open
devdras opened this issue Sep 21, 2022 · 1 comment
Open

Set output types #197

devdras opened this issue Sep 21, 2022 · 1 comment

Comments

@devdras
Copy link

devdras commented Sep 21, 2022

Hi, can you add the option for output types please? Could look something like this:
`async function getTextFromImage(filePath, outputType) {
await (0, _tar.extract)({
file: inputPath,
cwd: '/tmp'
});

if (outputType !== 'stdout' || outputType !== 'txt' || outputType !== 'pdf'|| outputType !== 'hocr'|| outputType !== 'tsv') {
return "BAD_OUTPUT_TYPE"
}

const stdout = (0, _child_process.execFileSync)(outputPath, [filePath, outputType, '-l', 'eng'], {
cwd: '/tmp/tesseract-standalone',
env: {
LD_LIBRARY_PATH: './lib',
TESSDATA_PREFIX: './tessdata'
}
});
(0, _child_process.execSync)(rm ${filePath});
return stdout.toString();
}`

@vladholubiev
Copy link
Member

PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants