VadimDez / ng2-pdf-viewer

📄 PDF Viewer Component for Angular
https://vadimdez.github.io/ng2-pdf-viewer/
MIT License
1.31k stars 421 forks source link

Horizontal scrollbar visible initially #1118

Open Ben555555 opened 3 months ago

Ben555555 commented 3 months ago
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 using the following settings:

.pdf-viewer {
    width:100%;
    height:100%;
}

<pdf-viewer class="pdf-viewer" [src]="data.options!.pdfSrc" [original-size]="false" [render-text]='false'
    [show-all]="true" [fit-to-page]="true" [zoom]="zoom"></pdf-viewer>

There is a horizontal scrollbar.

Only workaround I found is to change the zoom from 1 to 0.9 (or another value) and back to 1 like this:

  ngAfterViewInit() {
    setTimeout(() => {
      this.zoom = 0.999;

      setTimeout(() => {
        this.zoom = 1;
      }, 100);
    }, 100);
  }
VadimDez commented 2 months ago

Can you confirm it is the same behavior in version 10.3.1? Could you also try and see if you get the same on https://vadimdez.github.io/ng2-pdf-viewer/ ?

madieukhang commented 2 months ago

Hi @VadimDez Im using the newest version 10.3.0 and got width more than container with open pdf with modal if i press - then + it will get width normally I'm using pdf on your webiste not that got problem but my site got width more than container image

Can you help me Thanks

DaSchTour commented 1 month ago

Can you confirm it is the same behavior in version 10.3.1? Could you also try and see if you get the same on https://vadimdez.github.io/ng2-pdf-viewer/ ?

I can also see the same issue on the demo page. There is a horizontal scroll bar from the start. I tried to work with an initial zoom at 0.99 but that lead to some very strange display issues when trying to zoom. The document is not centered anymore and ist displayed two times.