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

Image in PDF doesn't load #6967

Open
tonyjin opened this issue Feb 10, 2016 · 9 comments
Open

Image in PDF doesn't load #6967

tonyjin opened this issue Feb 10, 2016 · 9 comments

Comments

@tonyjin
Copy link

tonyjin commented Feb 10, 2016

Tested in both Chrome and Firefox. Image in page 10 of the attached PDF (labeled page 8 in the document) doesn't load.

The Chrome native viewer and Adobe Reader both load the image properly.

temp_portfolio658660046914130129 (1).pdf

@timvandermeij
Copy link
Contributor

I can confirm this using Windows 10 x64, Firefox 44.0 and the latest PDF.js development version. It's unfortunate that there are no console messages about this.

@SamyCookie
Copy link

Same behaviour on Linux Debian stretch (testing), FF 44 and trunk pdf.js version. No console logs.

@brendandahl
Copy link
Contributor

The images are decoded fine. You can observe this by doing the following in paintInlineImageXObject() in canvas.js

--- a/src/display/canvas.js
+++ b/src/display/canvas.js
@@ -2067,6 +2067,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
         var tmpCtx = tmpCanvas.context;
         putBinaryImageData(tmpCtx, imgData);
         imgToPaint = tmpCanvas.canvas;
+
+        var div = document.createElement('div');
+        var imgData = tmpCtx.canvas.toDataURL();
+        var img = document.createElement('img');
+        img.src = imgData;
+        div.appendChild(img)
+        document.querySelector('#viewerContainer').appendChild(div);
       }

Seems to be an issue with how they're drawn. Quick look seems like the coordinates are messed up, but I'll have to look into it more later.

@Snuffleupagus
Copy link
Collaborator

Skipping the SMask case in CanvasGraphics_setGState "fixes" all the missing images in this PDF file, hence this issue is unfortunately yet another regression from PR #4161.

@yurydelendik
Copy link
Contributor

Looks like we are not handling AIS=false state properly. Switching mask off for this case helps the case.

@groovy21
Copy link

groovy21 commented Jun 9, 2017

Can someone please fix this issue in pdf js. This issue has ruined our experience in an application that is in production. If we dont get a fix we will have to abandon pdf.js and move to a different product. I dont want to do that as I find pdf.js really simple in its UI and dependencies.

@SamyCookie
Copy link

For reference, some images at page 6-8-10-14 are still missing.

@tony-pond

This comment has been minimized.

@THausherr
Copy link
Contributor

The original PDF is an SMask problem, this PDF doesn't have them. I suspect a problem with the JPX decoder. Page 1 has a JPX image, most of the other pages have JBIG2 images which show. Page 11 and 15 have both types, and the JPX image doesn't show. I suggest you create a new issue with your file.

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

9 participants