VadimDez/ng2-pdf-viewer

Rotation default value not working

daniela-alves opened this issue · 11 comments

Bug Report or Feature Request (mark with an x)
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [X ] Bug report -> please search issues before submitting
- [ ] Feature request
- [ ] Documentation issue or request

When I define the rotation by default when I load the document is not applied.

Example:
https://stackblitz.com/edit/ng2-pdf-viewer-qtq9ny?file=src%2Fapp%2Fapp.component.html,src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.css

By default I defined 180. When the document is loaded the rotation is not applied and seems to be 0.
If I click on the test button to set the rotation to 90, works.

i think this is the same like #976

Seems to be. Did you find a workaround until we have a fix?

@ftaffelt yeah, probably is. The wquestion is: does someone know how to overcome that isssue?

@ftaffelt yeah, probably is. The wquestion is: does someone know how to overcome that isssue?

@marcelocerqueira69, I would like to have it resolved too or even a way to achieve that

Same issue right here

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I haven't found yet a solution. Can someone help me, please?

Any news regarding this issue?

Same problem here, very annoying because the first page of the document is not rotated at loading.. Any idea when it will be corrected?
Thx for support

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Seems there's an internal change detection issue with the library.

I overcame this by forcing the code which sets the new default rotation amount to be a macro task, delaying it's execution:

your-pdf-display.component.ts

...
rotation = 0;

ngOnInit(){
  setTimeout(() => {
    this.rotation = 90;
  }, 0);
}
...

your-pdf-display.component.html

...
<pdf-viewer
  ...
  [rotation]="rotation">
</pdf-viewer>
...