Error displaying part of pdf: Codestream code 0xFF53 (COC) is not implemented

Hello, we have received a pdf, part of which is unreadable via pdfjsexpress.

It seems similar to Color elements not displayed, breaking whole PDF file (TypeError: codingStyleParameters is undefined etc.) · Issue #12752 · mozilla/pdf.js · GitHub.

Here’s the document on adobe acrobat:

And here it is on pdfjs express in the demo:

The console will print the following:

Warning: JPX: Trying to recover from: Codestream code 0xFF53 (COC) is not implemented
pdf.worker.js:129
Warning: Unable to decode image: TypeError: Cannot read properties of undefined (reading ‘decompositionLevelsCount’)
pdf.worker.js:129
Warning: JPX: Trying to recover from: Codestream code 0xFF53 (COC) is not implemented
pdf.worker.js:129
Warning: Unable to decode image: TypeError: Cannot read properties of undefined (reading ‘decompositionLevelsCount’)
pdf.worker.js:129
Warning: JPX: Trying to recover from: Codestream code 0xFF53 (COC) is not implemented
pdf.worker.js:129 Warning: Unable to decode image: TypeError: Cannot read properties of undefined (reading ‘decompositionLevelsCount’)
pdf.worker.js:129
Warning: JPX: Trying to recover from: Codestream code 0xFF53 (COC) is not implemented
pdf.worker.js:129
Warning: Unable to decode image: TypeError: Cannot read properties of undefined (reading ‘decompositionLevelsCount’)

Here’s the faulty pdf: document_old.pdf (100.4 KB)

Also, I’d like to know if it is possible to be notified if the pdf cannot be displayed properly via an event or a method call to display a message to the end user of our application :slight_smile:

Hi there,

This looks like a limitation on pdf.js to display the yellow parts of the provided pdf.

There is no event to distinguish if that particular error message is captured, but to display an error message you can use UI.displayErrorMessage API.

We recommend the Apryse WebViewer for handling this kind of document:

best regards,
Kevin