question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multiple viewers on one page

See original GitHub issue
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
- [x] Feature request
- [ ] Documentation issue or request

I want to display multiple PDF files one below the other on one page. Also the PDF viewer should display all pages below each other (the black rectangle stands for the viewport):

However, since the viewer container is absolutely positioned, this does not work at the moment because the viewers are stacked on top of each other.

I changed the style from .ng2-pdf-viewer-container to position: relative which leads to this error:

Error: The `container` must be absolutely positioned.

When I remove the position: absolute rule from the viewer-container in the dev tools of the browser, the preview works exactly as expected. So I don`t understand why this restriction is there?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

6reactions
Spielboergcommented, Jul 6, 2021

My current workaround:

<pdf-viewer
  class="pdf-viewer"
  [class.pdf-viewer--relative]="positionPdfViewerRelative"
  [src]="objectUrl"
  [fit-to-page]="true"
  [show-all]="true"
  (after-load-complete)="handlePdfLoaded()"
></pdf-viewer>
public positionPdfViewerRelative: boolean = false;

public handlePdfLoaded(): void {
  this.positionPdfViewerRelative = true;
}
.pdf-viewer {
  display: block;

  &--relative {
    ::ng-deep .ng2-pdf-viewer-container {
      position: relative;
    }
  }
}
3reactions
Spielboergcommented, Oct 5, 2021

@VadimDez There are more issues caused by the position: absolute: https://github.com/VadimDez/ng2-pdf-viewer/issues/805, https://github.com/VadimDez/ng2-pdf-viewer/issues/811 Therefore, please check whether this restriction is really necessary.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a single page with multiple views ... - YouTube
Do you want to create one page, with multiple screens (artboards), and also have each screen have a version for different devices?
Read more >
Use multiple viewers in the same page
Use multiple viewers in the same page. If your page has multiple instances of the `Viewer` component that don't use any plugin, then...
Read more >
Multiple report viewers on one page issue - MSDN - Microsoft
I am creating an ASP.NET 4.0 page with 2 report viewers (report viewer 10) each loading a different report. Both report viewers load...
Read more >
ruby on rails - How to include multiple views in one page?
I have set index.html as the 'show' action, but am unsure how to handle translate.html page. Both will have the same information/Rails form....
Read more >
Multiple viewers in a page
But things change when there are more than one PDF document to display in a single page. A single Embedded viewer or PDF...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found