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

Pattern: applying a transform breaks the pattern #17065

Closed
Dherse opened this issue Oct 3, 2023 · 5 comments · Fixed by #17067
Closed

Pattern: applying a transform breaks the pattern #17065

Dherse opened this issue Oct 3, 2023 · 5 comments · Fixed by #17067
Assignees

Comments

@Dherse
Copy link

Dherse commented Oct 3, 2023

Attach (recommended) or Link to PDF file here: test.pdf

Configuration:

  • Web browser and its version: Firefox 118.0.1 (64-bit)
  • Operating system and its version: Windows 10 22H2 19045.3448
  • PDF.js version: 3.10.86 [c72cb54]
  • Is a browser extension: no

Steps to reproduce the problem:

  1. Open the PDF in Firefox
  2. Compare with a version in Chrome/mupdf

What is the expected behavior? (add screenshot)
It should show four distorted rectangles each with a single contiguous color gradient from red to blue to green to purple (the red part is clipped). The file has been tested in the following viewers: Acrobat, mupdf, evince, XPDF, Chrome, SummatraPDF, and the Apple one and works in all of them.

image

What went wrong? (add screenshot)
For the two rectangles on which a skew & rotation is applied, the pattern does not appear:
image

Hope this is complete, thanks in advance,

Dherse :)

@Snuffleupagus

This comment was marked as outdated.

@Dherse

This comment was marked as off-topic.

@Snuffleupagus
Copy link
Collaborator

@calixteman Any ideas what could be wrong here?

@calixteman
Copy link
Contributor

Yes, it was a bit uneasy to find out what the issue is, but I found out:
https://github.com/mozilla/pdf.js/blob/master/src/display/canvas.js#L517-L524
We can't only consider the two opposite points to compute the bounding box.

@Dherse
Copy link
Author

Dherse commented Oct 3, 2023

Wow @calixteman I am blown away, thank you so much!

calixteman added a commit that referenced this issue Oct 3, 2023
Compute correctly the bounding box of a transformed rectangle (fixes #17065)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants