mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Fallback to built-in image decoding if the NativeImageDecoder
fails
In particular this means that if 'JpegDecode', in `src/display/api.js`, fails we'll fallback to the built-in JPEG decoder.
This commit is contained in:
parent
2570717e77
commit
76afe1018b
2 changed files with 9 additions and 6 deletions
|
@ -27,7 +27,11 @@ var PDFImage = (function PDFImageClosure() {
|
|||
*/
|
||||
function handleImageData(image, nativeDecoder) {
|
||||
if (nativeDecoder && nativeDecoder.canDecode(image)) {
|
||||
return nativeDecoder.decode(image);
|
||||
return nativeDecoder.decode(image).catch((reason) => {
|
||||
warn('Native image decoding failed -- trying to recover: ' +
|
||||
(reason && reason.message));
|
||||
return image;
|
||||
});
|
||||
}
|
||||
return Promise.resolve(image);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue