mozilla / pdf.js

PDF Reader in JavaScript
https://mozilla.github.io/pdf.js/
Apache License 2.0
48.32k stars 9.97k forks source link

PDF errors on rendering (Chinese document) #5752

Closed sethnk closed 9 years ago

sethnk commented 9 years ago

http://222.247.54.152/Fulltext/qkyxlcyjy200504007.pdf This PDF throws the following error:

Renders correctly in Adobe Acrobat.

PDF.js v1.0.1149 (build: bc7a110) Message: Invalid PDF structure

Windows x64, Chrome 39

Snuffleupagus commented 9 years ago

Complete error:

"Error: Invalid XRef table: unexpected first object" pdf.worker.js:250:4
"XRef_readXRefTable@resource://pdf.js/build/pdf.worker.js:3688:9
XRef_processXRefTable@resource://pdf.js/build/pdf.worker.js:3580:17
XRef_readXRef@resource://pdf.js/build/pdf.worker.js:3920:20
XRef_parse@resource://pdf.js/build/pdf.worker.js:3547:23
PDFDocument_setup@resource://pdf.js/build/pdf.worker.js:2742:7
PDFDocument_parse@resource://pdf.js/build/pdf.worker.js:2629:7
ensureHelper@resource://pdf.js/build/pdf.worker.js:2258:22
NetworkPdfManager_ensure/<@resource://pdf.js/build/pdf.worker.js:2272:7
NetworkPdfManager_ensure@resource://pdf.js/build/pdf.worker.js:2252:1
BasePdfManager_ensureDoc@resource://pdf.js/build/pdf.worker.js:2119:14
loadDocument/</<@resource://pdf.js/build/pdf.worker.js:33466:11
" pdf.worker.js:252:0
"Warning: Unsupported feature "unknown"" pdf.worker.js:235:4
"Warning: Unsupported feature "unknown"" pdf.js:235:4
"Warning: Indexing all PDF objects" pdf.worker.js:235:4
Snuffleupagus commented 9 years ago

Replacing error with warn at obj.js#L894 lets the file render, but I'm not sure if that really is a desirable "solution", since it basically moves a potential error to another part of the code-base.

timvandermeij commented 9 years ago

Adobe Acrobat is able to render this PDF file without a prompt upon closure, so I'm not sure if the PDF is in fact corrupt or if we just fail to parse it properly.