pdf.js: Error: Permission denied to access property 'print'

Configuration:

  • Web browser and its version: all versions of Firefox since PDF.js was included (5+ years)
  • Operating system and its version: all
  • PDF.js version: all
  • Is a browser extension: n/a

Steps to reproduce the problem:

  1. https://bugzilla.mozilla.org/show_bug.cgi?id=911444

What is the expected behaviour? That the PDF can print as in every other browser than Firefox

What went wrong? Error: Permission denied to access property 'print'

Please fix this as the go to universal print solution of PDF in browser has been broken for 5 years in Firefox since pdf.js was included in Firefox.

The web developer community has hundreds of bad solutions to this, because of a single project, pdf.js.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 12
  • Comments: 41

Most upvoted comments

@dotnetCarpenter the icing on the cake is that, over a year ago, one of the developers complained that all of the +1 comments make it harder to see the technical discussion and therefore harder to resolve the bug. As if that’s why it’s been open for over 6 years and counting. Without the voting system, such comments are now the ONLY way to call attention to an issue, so I see no alternative.

@swistak The good news is that this bug was fixed 1 month ago and will be in the next stable version of Firefox!

Firefox 87 should be release on 2021-03-23 - in just 13 days. You can download Firefox Developer Edition and begin testing at your work place now.

@vaspervnp The irony is that, that is the exact same Mozilla viewer embedded in Firefox!

We really need someone to change how pdf.js is embedded in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=911444#c58

Had the same issue using firefox. Solved it including the pdf into an iframe like this (the key is the way the pdf is linked):

`$(“.div_class”).html(‘<iframe id="frame_id"></iframe>’); $(‘#frame_id’) .attr(“src”, “path_to/PDFJS/web/viewer.html?file=path_to/file.pdf”) .on(“load”, function(){ setTimeout(printWhenReady, 3000); }); }

function printWhenReady(){ document.getElementById(frame_id).contentWindow.print(); }`

no, still SecurityError: Permission denied to access property "print" on cross-origin object error in firefox console

Thanks @dotnetCarpenter, I have voted on Bugzilla 🐞

@Ugoku and @jtraulle Please vote on https://bugzilla.mozilla.org/show_bug.cgi?id=911444 to get it on the radar for Firefox developers.