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

window.print() is blank #1131

Closed
AlbertoMontalesi opened this issue Jan 19, 2022 · 2 comments
Closed

window.print() is blank #1131

AlbertoMontalesi opened this issue Jan 19, 2022 · 2 comments
Assignees
Labels
bug Something isn't working Confirmed I've managed to reproduce the bug. That's great news: chances are I'll solve it. Solved

Comments

@AlbertoMontalesi
Copy link

AlbertoMontalesi commented Jan 19, 2022

Describe the bug
It's very simple, go here https://pdfviewer.net/extended-pdf-viewer/simple and call window.print() in the console. the page is blank.

Version info

  • 2.12.548

Happens on both latest Safari and Chrome

@AlbertoMontalesi AlbertoMontalesi changed the title Attempting to print a PDF, messes up window.print() window.print() is blank Jan 19, 2022
@stephanrauh
Copy link
Owner

This bug is caused by a CSS rule that's important for printing the PDF file:

@media print {
  body {
    & > * {
      display: none !important;
    }
}

How much does it hurt? I could try to add dynamic CSS, but I'm afraid of the side effects. I suppose it's better if you overwrite the rule in your application.

@stephanrauh stephanrauh self-assigned this Apr 10, 2022
@stephanrauh stephanrauh added bug Something isn't working wontfix This will not be worked on Confirmed I've managed to reproduce the bug. That's great news: chances are I'll solve it. labels Apr 10, 2022
@stephanrauh stephanrauh reopened this Apr 10, 2022
@stephanrauh stephanrauh added Working on it I've started to work on this ticket. More often than not, that means the feature is delivered soon. and removed wontfix This will not be worked on labels Apr 10, 2022
@stephanrauh
Copy link
Owner

As it turns out, implementing your feature is easier than thought. You bugfix is going to land soon with version 13.0.0-alpha.6.

@stephanrauh stephanrauh added Solved and removed Working on it I've started to work on this ticket. More often than not, that means the feature is delivered soon. labels Apr 10, 2022
stephanrauh added a commit to stephanrauh/pdf.js that referenced this issue Apr 10, 2022
…ules dedicated to printing PDF files to pdf.js
stephanrauh added a commit to stephanrauh/pdf.js that referenced this issue Apr 10, 2022
…ules dedicated to printing PDF files to pdf.js
stephanrauh added a commit that referenced this issue Apr 10, 2022
…he initialization of the PDF viewer; #1131 limit the scope of the CSS rules dedicated to printing PDF files to pdf.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Confirmed I've managed to reproduce the bug. That's great news: chances are I'll solve it. Solved
Projects
None yet
Development

No branches or pull requests

2 participants