mozilla / pdf.js

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

Filter or Blend not applied correctly. #6951

Open richerm opened 8 years ago

richerm commented 8 years ago

I am experiencing an issue where a particular filter or gradient is not being correctly applied. In the attached document the 'o' in Imodium in Adobe Reader shows a lighter blue swirled into the darker blue. In PDF.JS this appears as a light blue to grey to dark blue.

Tested on Win7&Win10-Firefox 43.0.4 with built-in viewer. Tested on Win7&Win10-Chrome 48.0.2564.97 m + Firefox 43.0.4. Also tested with Chrome's built-in viewer which also failed but not relevant here.

PDF 110dd61fd57444010b1ab5ff38782f0f [1.4 pdfeTeX-1.21a / TeX](PDF.js: 1.4.37) PDF 20f7e4cdf6834d508060b9490960c9bb [1.4 Adobe PDF library 10.01 / Adobe Illustrator CS6 (Macintosh)](PDF.js: 1.4.37)

Please find a simplified example attached: ImoLogo.pdf

comparison

yurydelendik commented 8 years ago

Also the same issue with Mac OSX Preview

SamyCookie commented 8 years ago

Failed also with Firefox 44 and chromium 38 on Debian systems.

edit: ... and fails also with Okular

richerm commented 8 years ago

Also confirmed GhostScript fails at it, NitroPdf, and handful of other converters/rendering to image tools. Seems pretty widespread which is quite perplexing.

yurydelendik commented 8 years ago

The PDF contains really complex function-based shading type 2 with custom/function-based two component colorspace. What can go wrong? :)

screen shot 2016-02-02 at 11 44 34 am
richerm commented 8 years ago

@yurydelendik Looks complicated just looking at it :).

Is there recommendations I should be providing upstream to avoid this other then 'don't use functions on functions to perform shading'?

Is this something that will be looked at, or due to the complexity dropped in priority?

Aside: What tool do you use to dissect the PDF like the screenshot above? I've been using Notepad++ which obviously doesn't decode the streams for me or make it like hierarchical like yours.

yurydelendik commented 8 years ago

http://brendandahl.github.io/pdf.js.utils/browser/

Not sure if the generator "Adobe Illustrator CS6 (Macintosh)" has different method of generating the same image/result.

THausherr commented 3 years ago

IMHO it is related whether one uses the separation colors directly in the DeviceN colorspace (which is what PDFBox does and gets a nice rendering for this file but not for another), or use the AlternateCS and tintTransform parameters (which is what PDF.js and GS do, and don't get a nice rendering for this file). See also https://issues.apache.org/jira/browse/PDFBOX-5074