mozilla / pdf.js

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

Firefox java pdfviewer will not render pdf files produced with Abbyy Finereader 12 MRC #7802

Open TomTryniski opened 7 years ago

TomTryniski commented 7 years ago

Link to PDF file (or attach file h Wheeling VA Daily Intelligencer 1880 (12) 11889.pdf ere): This pdf will render correct in Adobe Reader and all other pdf programs..... Configuration:

Steps to reproduce the problem:

  1. opening up in Firefox version listed above using PDF.js 1.5.281 will not render to completion

What is the expected behavior? (add screenshot) render correct in acrobat 11

not rendering to compleation

What went wrong? (add screenshot) PDF 3c59342386944363c6382a881762632d [1.5 Imaging&Processing Works 119 Hahashmonaim Street, Tel Aviv, Israel / OK Washington... Here Comes Trump Ready or Not !] (PDF.js: 1.5.281)viewer.js:7832:7 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yetpdf.js:277:5 Warning: Unable to decode image: InternalError: size and count too largepdf.worker.js:2298:5 Warning: Dependent image isn't ready yet

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):

Snuffleupagus commented 7 years ago

The issue seems to be that one of the images in the PDF file has a ridiculously large image Mask, see the excerpt obtained with http://brendandahl.github.io/pdf.js.utils/browser/:

CL (stream) [id: 7, gen: 0]
    Mask (stream) [id: 8, gen: 0]
        Subtype = /Image
        BitsPerComponent = 1
        Width = 20595
        Interpolate = true
        ImageMask = true
        Height = 28611
        Filter (array)
        Type = /XObject
        Length = 1141122
    Subtype = /Image
    BitsPerComponent = 8
    Width = 1716
    Interpolate = true
    ColorSpace = /DeviceGray
    Height = 2384
    Filter (array)
    Type = /XObject
    Length = 2234

The failure occurs at line src/core/image.js#L588, since trying to allocate a typed array that is 2356974180 bytes (i.e. approximately 2.2 GB) isn't possible.