Closed Bug 1664178 Opened 4 years ago Closed 4 years ago

PDF documents previewed via Printer icon are not displayed correctly


(Core :: Print Preview, defect, P2)




82 Branch
Tracking Status
firefox-esr68 --- unaffected
firefox-esr78 --- unaffected
firefox80 --- unaffected
firefox81 --- wontfix
firefox82 --- fixed


(Reporter: vlucaci, Assigned: emilio)


(Blocks 1 open bug, Regression)


(Keywords: regression, Whiteboard: [print2020_v82] [old-ui-] )


(2 files)

Attached image pdf995.gif

Affected versions

  • 81.0b8
  • 82.0a1 (2020-09-10)

Affected platforms

  • Windows 10x64
  • Ubuntu 18.04
  • macOS 10.14

Steps to reproduce

  1. Launch FF.
  2. Go to
  3. Print preview the page via burger menu or CTRL+P
  4. Close the PP modal.
  5. Click on the PDF Print button.

Expected result

  • Document is displayed in the same way in .js module as it is presented in Print Preview.

Actual result

  • Document opened in pdf.js module displays pages randomly(sometimes inverted, sometimes zoomed in, sometimes zoomed out, etc)

Suggested Severity

  • Seeing as how this issue only occurs with this specific document, I would suggest an S3

Regression range

  • Will return with regression ASAP

Additional notes

  • Did not manage to reproduce this issue with other pdf documents.
  • This issue does not occur for the old UI.

I was unable to narrow the regression down even more than :

I suspect 1661627 is the culprit here. Hiro, could you take a look?

Has Regression Range: --- → yes
Has STR: --- → yes
Flags: needinfo?(hikezoe.birchill)
Keywords: regression
Severity: -- → S3
Priority: -- → P2
Whiteboard: [print2020_v81] [old-ui-] → [print2020_v82] [old-ui-]

I think this is caused by the same root cause of bug 1663448.

Flags: needinfo?(hikezoe.birchill)
Regressed by: 1662914
See Also: → 1663448

Emilio is totally right (as in bug 1663448 comment 4).

In this pdf case, there remain stateStack when endDrawing is called from cancel().

  for (let i = this.stateStack.length; i > 0; i--) {                        

I've confirmed that adding above code in endDrawing fixes this case and bug 1663448, but I am totally unsure about the relationship between stateStack and this.current.activeSMask (mask operations).

Brendan, can you please take care of this bug, or tell me what the right approach to fix this bug? Thanks!

Flags: needinfo?(bdahl)

Whatever that state is restoring, this function should clear it to. Probably the transform matrix should be set to an identity.

Probably just calling ctx.resetTransform() should do.

Attached file PDF.js PR
Assignee: nobody → emilio
Flags: needinfo?(bdahl)

Should be fixed by bug 1665812.

Closed: 4 years ago
Depends on: 1665812
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch
You need to log in before you can comment on or make changes to this bug.