-
-
Notifications
You must be signed in to change notification settings - Fork 423
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
scale not correctly updated on pdf-viewer rotation for pdf page with 90° rotation #992
Comments
@QuentinChaumont thanks for the PR! i've just tested and see no difference before and after applying your changes. Can you please make some screenshots showing the difference before vs after? |
It's a very specific use-case appear only with pdf saved with internal rotation in some pages. For normal pdf pages without internal rotation (page.rotation) it's work fine with 90° rotation and zoom-scale= 'page-width' the pdf resize to take all the width space : When I go to the third page of my pain in the ass pdf which has an internal rotation (page.rotation = 90), you can see that the pdf does not resize to use full width : After my quick fix, behaviour does not change normal pages rotation but fix the pages with internal rotation : |
If you want to try by yourself i give you my pdf :
|
Thx for your time. |
fix #992 : fix rotation on pdf with included rotation
Thanks @QuentinChaumont, I could replicate the issue with your PDF, will publish |
Bug Report or Feature Request (mark with an
x
)Hi, first of all thanks for your work.
Configuration of pdf-viewer :
[original-size]="false"
[page]="pageNumber"
[render-text]="true"
[show-all]="false"
[rotation]="rotation"
[show-borders]="false"
[src]="src"
[zoom-scale]="'page-width'"
Description of the issue :
When I'am using a pdf with pages already rotated on pdf-viewer it display perfectly.
But when I apply a pdf-viewer rotation of 90° on it the width scale is not updated. So my pdf succesfully rotate but it is cropped because width scale did not update.
Resolution of the issue :
I managed to find the reason on pdf-viewer.component.ts line 323 :
const rotation = this._rotation || page.rotate;
The fix is simple :
const rotation = this._rotation + page.rotate;
Explanation of the fix :
Without fix : const rotation = this._rotation || page.rotate; :
1 - pdf page with rotation already applyed on it is loaded
2 - const rotation = 90 (from page.rotate) ✔️
3- I apply pdfViewer rotation on it
4- const rotation = 90 (from this._rotation) ❎
With fix : const rotation = this._rotation + page.rotate; :
1 - pdf page with rotation already applyed on it is loaded
2 - const rotation = 90 (from this._rotation 0 + page.rotate 90 ) ✔️
3- I apply pdfViewer rotation on it
4- const rotation = 180 (from this._rotation 90 + page.rotate 90 ) ✔️
I'm doing pull request to fix this for you.
Have a good day
The text was updated successfully, but these errors were encountered: