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

[Bug]: Invalid rendering because of no colorspace #18466

Closed
calixteman opened this issue Jul 20, 2024 · 1 comment · Fixed by #18467
Closed

[Bug]: Invalid rendering because of no colorspace #18466

calixteman opened this issue Jul 20, 2024 · 1 comment · Fixed by #18467
Assignees

Comments

@calixteman
Copy link
Contributor

Attach (recommended) or Link to PDF file

image2.pdf

Web browser and its version

Firefox nightly

Operating system and its version

Windows 11

PDF.js version

last one

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

Open the pdf

What is the expected behavior?

image

What went wrong?

image

Link to a viewer

No response

Additional context

The bug has been reported:
https://issues.apache.org/jira/browse/PDFBOX-5851

As mentioned in the bug report, scn and SCN are used without a previous call to cs so we fallback on DeviceGray:

pdf.js/src/core/evaluator.js

Lines 4876 to 4877 in ed83d7c

this.fillColorSpace = ColorSpace.singletons.gray;
this.strokeColorSpace = ColorSpace.singletons.gray;

We should probably have a null rgb color or something like that to indicate to use a fully transparent one.

The rendering is correct in either Acrobat or Chrome.

@Snuffleupagus
Copy link
Collaborator

As mentioned in the bug report, scn and SCN are used without a previous call to cs so we fallback on DeviceGray:

Yes, because as far as I understand that's what the PDF specification says should be the default value in https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#G7.3881830

Parameter Type Value
color space name or array The current colour space in which colour values shall be
interpreted (see 8.6, "Colour Spaces"). There are two
separate colour space parameters: one for stroking and one
for all other painting operations. Initial value: DeviceGray.

We should probably have a null rgb color or something like that to indicate to use a fully transparent one.

We might need to somehow limit that to the /Pattern handling, since given the above I'd worry about regressions elsewhere if we do that unconditionally (especially since the PDF document in question is corrupt).

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