-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Message: Invalid PDF structure #7247
Comments
Please check if the issue is present in the latest version of PDF.js, which as of this writing is If the issue is still present there, you need to provide the PDF file in order for the issue to be valid, see also https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md. |
Make the non-confidential example for us. |
Thanks for the quick reply. I'm trying use the latest version. And finding the right document to test and share if it fails. |
I tested with 1.5.188 version. I'm getting this error as well - Error: Invalid XRef stream header. I'm not able to share the pdf file as I'm unable to upload and test in our server.
Please provide your comments. |
Without complete example it's hard to tell. So far we can assume you are doing one of the steps above wrong or you have incorrectly encoded base64 pdf data. |
Closing as incomplete based on the statement above. Please provide complete example to reproduce the issue on the computer other than yours to reopen the issue. |
The same code is working in another module. The base64 conversion is done in java and returned. |
It works for me if I run the following in the console (of http://mozilla.github.io/pdf.js/web/viewer.html page):
The difference is that there is no base64 transforms, so if you are doing create blob and url opening steps right the problem is with your base64 encoding and/or decoding. |
|
Forgot to mention, Thank you so much for quick responses. |
Running the code above in the browser does not produce any output. |
Can you share the code to decode base64 string to uint8array |
See https://github.com/mozilla/pdf.js/blob/master/examples/learning/helloworld64.html . Notice that Blob can accept output from atob as well. |
Tried with ;atob' function passing base64 string. Still getting "Invalid PDF Structure". Will try to attach PDF today. |
If I'm getting byte array from java. What is the way to use it with viewer.html. Sample code will help me. |
@eswarpdf don't use base64, just return stream of bytes using setContentType, setContentLength and getOutputStream. See for example http://www.avajava.com/tutorials/lessons/how-do-i-serve-up-a-pdf-from-a-servlet.html . base64 is wasteful for a server's and a web browser's resources. P.S then just pass a servlet's URL to the viewer.html |
My initial approach itself working. There was mismatch is params passed to URL. |
I've gone through this thread - #3977 and using latest PDF.js version( 1.5.188). The line number 1103 in pdf.js is different in 1.5.188 version. Is it still an open issue? |
Please do not post comment on this issue that are not related to the original reason this issue was opened. Use the mailing list or IRC to get help with custom solutions. |
Link to PDF file (or attach file here):
Can't add pdf file here as it is confidential.
Configuration:
Steps to reproduce the problem:
What is the expected behavior? (add screenshot)
pdf viewer rendering pdf file successfully.
What went wrong? (add screenshot)
Other notes:
I'm using pdf.js viewer in multiple modules. I was able to use viewer in couple of modules successfully. But in one module I'm getting the error. All the pdf files are either scanned files or normal pdf's.
Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):
The text was updated successfully, but these errors were encountered: