Skip to content
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

Viewer Constructor blocks remote rendering #12385

Closed
jsg2021 opened this issue Sep 16, 2020 · 3 comments · Fixed by #12388
Closed

Viewer Constructor blocks remote rendering #12385

jsg2021 opened this issue Sep 16, 2020 · 3 comments · Fixed by #12388
Labels

Comments

@jsg2021
Copy link
Contributor

jsg2021 commented Sep 16, 2020

Attach (recommended) or Link to PDF file here:

Configuration:

  • Web browser and its version: all
  • Operating system and its version: all
  • PDF.js version: 2.6.347
  • Is a browser extension: no

Steps to reproduce the problem:
Construct the viewer and give it a div hosted in another frame... when it was working, it now throws

Invalid `container` and/or `viewer` option.

This broke it: 89f6bb0

What is the expected behavior?
Allow constructing a viewer that renders to an alternate window.

@boulderx
Copy link

When will there be a new release including this fix?

@WolfgangFahl
Copy link

WolfgangFahl commented Sep 18, 2023

Why is this closed? I get the message in my code on the following line:

const pdfViewer = new pdfjsViewer.PDFViewer({
      container,
      eventBus,
      linkService: pdfLinkService,
    });

Which is copied straight from https://github.com/mozilla/pdf.js/blob/master/examples/components/simpleviewer.js

I don't understand what this message is about. Why would a div be an invalid container? Why is the viewer needed at construction time?

@twitwi
Copy link

twitwi commented Dec 18, 2023

For anyone that would follow the same path as me: I ended up on this issue and found out that the cause/solution is that the element passed as container must have a child div for pdfjs to plug into, as in:

    <div class="container">
        <div></div>
    </div>
.container {
    position: absolute;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants