-
-
Notifications
You must be signed in to change notification settings - Fork 421
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
Component stops rendering when display goes out of view #219
Comments
I have a similar issue here.
in the console whereas chrome shows nothing. |
@JbRezidu I'll share you the important bits of my code as a workaround. Component template:
Component:
The function is triggered when I focus the |
@tarekis Thx for the answer, with this.pdfViewer.update() I can see my file now. |
Or not... I think the problem is reproductible when the container is smaller than the pdf original width. When I play with options, loading spinners still displayed :
When I increase my container size until its max-width, the pdf shows up... the loader spinners disappear when the container width is big enough (even if original pdf width isn't reached). So strange :-( |
I still gettin this loader spinners after loading is done and able to get the numPages. Help anybody? |
We also got this problem after updating from ng2-pdf-viewer version 2 to version 3. Could it maybe be this change: a96fb1a (downgrade of pdfjs from 1.9.607 to 1.8.619) |
I've found the solution (rocks in my app with flexbox) : add a "position: relative" on your container children ("div")... |
@castevinz You saved me a couple of hours with this one. Added this to my global style: .ng2-pdf-viewer-container > div
{
position: relative;
} Component SCSS: .pdf-viewer
{
max-width: 300px;
} And the template: <pdf-viewer class="pdf-viewer" [src]="receipt.url" [render-text]="false" [original-size]="false" [autoresize]="true" ></pdf-viewer> And then it was rendering finally after that. |
When the component leaves the view, hence no longer is visible it will not render correctly, and display only loading spinners as soon as you bring the component into the view, just as in #201.
You can then trigger a update (by ViewChild refrence) and the component will update correctly, that is until you'd bring the component out of view again, as it will stop where it currently was when leaving the view.
For reconstruction purposes; i used Angular Material Tabs in a Expansion Panel, and put the component in the second tab.
The text was updated successfully, but these errors were encountered: