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

tesseract: [FIX] pdf pre-processing #468

Merged
merged 1 commit into from
Feb 11, 2023

Conversation

bosd
Copy link
Collaborator

@bosd bosd commented Feb 10, 2023

Before this PR the mimetype of the input file was detected by it's extension.
It works fine for cli usage.

It fails when invoice2data is used as a library and a tempfile/stream is used as an input. (as there is no extension available)
Making it impossible to parse pdf files when using invoice2data as a library.
As tesseract cannot handle pdf files as an input.

After this pr, the mimetype is also detected when using invoice2data as a library.

@m3nu , @rmilecki I'm consideirng this as a hotfix, so fasttracking this one.

detect the mimetype of the input, also when using invoice2data as a library
@bosd bosd merged commit 26aa28a into invoice-x:master Feb 11, 2023
@bosd bosd deleted the fix-tesseract-stream branch February 11, 2023 07:31
@rmilecki
Copy link
Collaborator

Thanks for handling this.

@bosd
Copy link
Collaborator Author

bosd commented Feb 18, 2023

It turns out, this really did not make a difference. The guess_type function also looks at the file extension.
Instead of running low level compares on the content.

It turned out that the problem was in the program calling invoice2data.
It was passing a tempfile without extension.
Forcing the program to always pass the .pdf extension fixed it.

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

Successfully merging this pull request may close these issues.

2 participants