Open Bug 1934160 Opened 3 days ago Updated 3 days ago

Shifted view in PDF with cm command after path construction.

Categories

(Firefox :: PDF Viewer, defect, P3)

Firefox 131
defect

Tracking

()

UNCONFIRMED

People

(Reporter: alex, Unassigned)

References

Details

Attachments

(1 file)

Attached file 92216i7.pdf

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0

Steps to reproduce:

Open the attached PDF file as File->Open

Actual results:

Black line is shifted down relatively to the red square.

Expected results:

Black line must be on about the same level. See how Acrobat Reader, Evince or Ghostscript render the sample file.

The Bugbug bot thinks this bug should belong to the 'Firefox::PDF Viewer' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → PDF Viewer

The % preceding the cm command is treated as a comment delimiter, hence the cm is just ignored.
From the specs:

7.2.3 Comments

Any occurrence of the PERCENT SIGN (25h) outside a string or stream introduces a comment. The comment
consists of all characters after the PERCENT SIGN and up to but not including the end of the line, including
regular, delimiter, SPACE (20h), and HORZONTAL TAB characters (09h). A conforming reader shall ignore
comments, and treat them as single white-space characters. That is, a comment separates the token preceding
it from the one following it.

so the percent sign should just be ignored.

Severity: -- → S3
Priority: -- → P3

(In reply to Calixte Denizet (:calixte) from comment #2)

The % preceding the cm command is treated as a comment delimiter, hence the cm is just ignored.
From the specs:

7.2.3 Comments

Any occurrence of the PERCENT SIGN (25h) outside a string or stream introduces a comment. The comment
consists of all characters after the PERCENT SIGN and up to but not including the end of the line, including
regular, delimiter, SPACE (20h), and HORZONTAL TAB characters (09h). A conforming reader shall ignore
comments, and treat them as single white-space characters. That is, a comment separates the token preceding
it from the one following it.

so the percent sign should just be ignored.

Unfortunately it doesn't seem to be that easy, since it's not uncommon for streams to contain comments and just ignoring the %-character will thus break many more cases than it'd fix.

So my comment was wrong: the percent sign is used for comments even in streams.
The test case can be reduced to:

q
0 0 200 5 re
300 0 200 5 re
1 0 0 1 0 700 cm
f
Q

In pdf.js we create two rectangle on the bottom of the page, set the current transform and then fill the rectangles. In the canvas the current transform isn't applied to the current path...

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: