You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [x] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request
A PDF file can be rotated when created/edited with a PDF tool (Adobe Reader, Preview, etc).
The rotation is stored in the PDF file as a property: /Rotate 270 e.g.
Open a PDF in a text editor to check if it has rotation.
Note: page orientation (portrait vs landscape) has nothing to do with rotation.
Before release 5.3.4
The scale was computed as follows
scale = this.getScale((page as any).getViewport({ scale: 1 }).width);
As explained here, if the rotation parameter is not defined, PDFJS uses the Rotate property defined in the PDF file.
Since release 5.3.4
The scale is computed as follows
By default, the scale is computed assuming no rotation (this._rotation = 0).
So, if the PDF file contains a rotation of 90, 270, etc., width and height are inverted and the PDF is displayed in the viewer with a scrollbar on the x axis (if width is originally smaller than height).
This bug cannot be solved by setting the [rotation] option.
Solutions
One solution (hot fix) is not to specify rotation in the scale computation if the rotation option has not been specified by the user. However, the rotation option will still not work for PDFs that already contain a rotation.
A better solution would be to take into account the Rotate property of the PDF.
The text was updated successfully, but these errors were encountered:
PR #508 introduced a regression in release 5.3.4.
A PDF file can be rotated when created/edited with a PDF tool (Adobe Reader, Preview, etc).
The rotation is stored in the PDF file as a property:
/Rotate 270
e.g.Open a PDF in a text editor to check if it has rotation.
Note: page orientation (portrait vs landscape) has nothing to do with rotation.
Before release 5.3.4
The scale was computed as follows
As explained here, if the
rotation
parameter is not defined, PDFJS uses theRotate
property defined in the PDF file.Since release 5.3.4
The scale is computed as follows
By default, the scale is computed assuming no rotation (
this._rotation = 0
).So, if the PDF file contains a rotation of 90, 270, etc., width and height are inverted and the PDF is displayed in the viewer with a scrollbar on the x axis (if width is originally smaller than height).
This bug cannot be solved by setting the
[rotation]
option.Solutions
One solution (hot fix) is not to specify rotation in the scale computation if the
rotation
option has not been specified by the user. However, therotation
option will still not work for PDFs that already contain a rotation.A better solution would be to take into account the
Rotate
property of the PDF.The text was updated successfully, but these errors were encountered: