-
Notifications
You must be signed in to change notification settings - Fork 377
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
can't read file, no event fire #221
Comments
I can approved this (v1.2.0) for the linked file. I have a similiar problem with one of my files, but I get an error message (Invalid XRef stream header) in the console instead in the events. No timeout, no events, only an eternal ghost process. Edit: My "solution" is a timeout for x seconds. If the timeout triggers, call the error part. If the normal events trigger and the timeout is waiting, clear timeout and work normally. In my case it's ok to have some ghost process. |
@maelyt thank you very much, but i think there is some bug with pdf2json, because pdf.js can render this file correctly, pdf2json based on pdf.js, so i think maybe this is a small problem and can be fixed relatively easily |
I think it is not that easy. I looked into the code and pdf.js is mounted via eval() into the pdf2json-environment. Also the pdf.js files are not the same as the original pdf.js repo. They are extracted from the project. It could be, that the version in pdf2json has the bug and the current version of pdf.js has a fix for it. But I stopped there because I really don't want to go down this rabbit hole. |
@ishowshao get same problem. And the way we use is same... extract file text to submit an expense account. If you solved the problem , please let me know |
Had the same issue as @maelyt (1.2.0) Indeed, if It works with the kind of PDF I'm using. That's quite a dirty workaround, but hopefully this will do the job for people having the same issue |
@rascafr It works. And I improve it. When i review the code found these files can
|
@sologgfun did you manually edited the I'm still having issues, but without any error being thrown. This said, I wrapped your code into a try / catch bloc, with the cls.prototype.parsePDFData = function (arrayBuffer, password, parent) {
this.pdfDocument = null;
let parameters = {
password: password,
data: arrayBuffer
};
PDFJS.getDocument(parameters).then(
pdfDocument => {
try {
if (pdfDocument.pdfInfo.metadata) {
console.log('Meta ready');
//parent.emit("pdfjs_parseDataReady", pdfDocument.pdfInfo.metadata.split(/[\n]/));
}
this.load(pdfDocument, 1);
} catch (e) {
console.log(e);
}
},
error => this.raiseErrorEvent("An error occurred while parsing the PDF: " + error)
)
}; It throws the following error, so it might came from the original PDFJS wrapped code, how did you ended up making it work in your case?
|
Any updates? We're having this issue too. |
fix pushed. test with `git pull && rm -rf node_modules/ && npm i && npm run test-misc" please. |
fixed in v1.2.5 |
Hi, using master version and uploading this document I'm still getting no event fired. |
can not read some file, you can try this file download
code sample:
neither
pdfParser_dataError
orpdfParser_dataReady
firebut, pdf.js viewer can render this file
help me, thanks !!
The text was updated successfully, but these errors were encountered: