Skip to content
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

DPUScan pdf shows black screen #10026

Closed
sabeesh-mani opened this issue Sep 1, 2018 · 16 comments
Closed

DPUScan pdf shows black screen #10026

sabeesh-mani opened this issue Sep 1, 2018 · 16 comments

Comments

@sabeesh-mani
Copy link

sabeesh-mani commented Sep 1, 2018

Attach (recommended) or Link to PDF file here:
I am unable to get the official document due to restriction. But I have attached the screenshot. The issue seems to happen for all DPUScan documents of pdf 1.5
img-20180831-wa0006

Configuration:

  • Web browser and its version: Firefox 45. Also tested on Firefox 52
  • Operating system and its version: Windows 7
  • PDF.js version: Tested with 2.0.55.0 and 1.10.100
  • Is a browser extension: No

Steps to reproduce the problem:

  1. Rendering the DPUScan pdf 1.5 version document via pdf.js gives black screen. I also tried opening the same document via online viewer and also ended up with black screen.
  2. Attached the screenshot of the problem.

What is the expected behavior? (add screenshot)
PDF should be rendered correctly

What went wrong? (add screenshot)
Black screen is shown

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

@timvandermeij
Copy link
Contributor

timvandermeij commented Sep 1, 2018

From https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md:

If the issue is related to errors produced by a specific PDF, please always include the PDF by providing a URL where contributors can download it. Without a PDF for reproduction, such issues will be closed.

Closing since there is nothing we can do without an example PDF file. Perhaps you can make a non-classified PDF file with the same tool to share here, after which we can reopen this.

@sabeesh-mani

This comment was marked as outdated.

@sabeesh-mani
Copy link
Author

Finally managed to get a non-classified pdf file. I have attached the same here. Can someone have a look?
test.pdf

@THausherr
Copy link
Contributor

The file also fails in PDFBox… in java the image has an RGB icc colorspace but in the raster it has only 1 band with 1 bit pixels. One would have to analyze the JPEG2000 image with a good tool that tells what meta data is really there..
PDFJS-10026-image.zip

@sabeesh-mani

This comment was marked as outdated.

@THausherr
Copy link
Contributor

issue for PDFBox:
https://issues.apache.org/jira/browse/PDFBOX-4326

@THausherr
Copy link
Contributor

THausherr commented Sep 29, 2018

Here's another exotic PDF file with a JPEG2000 image that can't be rendered with PDF.js (page 11, bottom right); the JPEG2000 image has 4 bits per pixel.
https://issues.apache.org/jira/secure/attachment/12655396/PDFBOX-2204-012411.pdf

@sabeesh-mani

This comment was marked as spam.

@sabeesh-mani

This comment was marked as spam.

@GabrielfLuchtenberg

This comment was marked as duplicate.

@gschuler

This comment was marked as duplicate.

@gschuler

This comment was marked as duplicate.

@LeonardoPrange

This comment was marked as duplicate.

@THausherr
Copy link
Contributor

I did some debugging and looked at jpx_stream.js. After jpxImage.parse() the object has 1 tile which is only zeroes. The size is correct, i.e. 2496 x 3512 = 8765952.

(With the other file I attached, the decoded bytes were all 255)

So this suggests that the problem is in the JPEG2000 decoder and not with the colorspace as in PDFBox.

@rafaelcaviquioli this is an open source project and powered by volunteers who may or may not have time. Re "my head depending on this solution": if it is so, then free somebody or several people of your team for a few days and have them debug the JPEG2000 decoder. The show happens in
https://github.com/mozilla/pdf.js/blob/master/src/core/jpx.js
near "case 0xFF93:".
Compare what is happening with the JPEG2000 specs (see https://jpeg.org/jpeg2000/ ) or compare what is happening to a working JPEG2000 decoder, e.g. the one from Java,
https://github.com/jai-imageio/jai-imageio-jpeg2000/

@kernelshreyak
Copy link

This seems to have been fixed in PDFBox (https://issues.apache.org/jira/browse/PDFBOX-4326).
But in pdf.js this still exists.

@timvandermeij
Copy link
Contributor

Closing since both the test file and the PDFBox file now render correctly in the most recent version of PDF.js, most likely thanks to #17946.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants