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

wrong line dash pattern rendering behavior when dash array is empty #17904

Closed
ex37 opened this issue Apr 8, 2024 · 2 comments · Fixed by #17905
Closed

wrong line dash pattern rendering behavior when dash array is empty #17904

ex37 opened this issue Apr 8, 2024 · 2 comments · Fixed by #17905
Assignees

Comments

@ex37
Copy link
Contributor

ex37 commented Apr 8, 2024

Link to PDF file here:
dash_array_example.pdf

Configuration:

  • Web browser and its version: chrome 123 (not important)
  • PDF.js version: 4.1.367

Steps to reproduce the problem:

  1. open inside pdf.js viewer any pdf file which has an annotation with an empty array as a dash pattern

What is the expected behavior?
from PDF spec, page 218:
Screenshot 2024-04-08 at 5 04 00 PM
it's completely valid having empty dash array, and in Acrobat line is rendered with proper width:

dash_array_acrobat

What went wrong?
cause of the following line:

this.width = 0; // Adobe behavior when the array is invalid.

annotation width is set to 0, when dash array is empty.
dash_array_pdfjs

A solution could be changing the else if statement to smth like this:
else if (!Array.isArray(dashArray))

@timvandermeij
Copy link
Contributor

Fixed by the PR above. Thank you for reporting this and providing a good analysis to reproduce the issue!

@ex37
Copy link
Contributor Author

ex37 commented Apr 8, 2024

thanks for the quick fix

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.

2 participants