0

How can I force pdf to be printed at the user end? I've pdf file and I use iframe to insert it and print out:

<iframe id="iFramePdf" src="/rates.pdf" style="display:none;"></iframe>
<script type="text/javascript">  // print pdf in iFrame  
function printTrigger(elementId) {
    var getMyFrame = document.getElementById(elementId);
    getMyFrame.focus();
    getMyFrame.contentWindow.print();
}
</script>

But because of FF browser settings it failed to print. I know of this soltion to this issue and I've fixed the issue in my FF browser. But I can't fix FF settings at user browser.

Can I bypass it somehow? How to print pdf any other way?

Update

The following image shows what setting I've done to make pdf to be printable in FF:

enter image description here

Can I make *.pdf file prinable bypassing browser settings?

Community
  • 1
  • 1
Igor Savinkin
  • 5,669
  • 8
  • 37
  • 69
  • "because of FF browser settings it failed to print". Can you be more specific about what settings are and how they prevent you from printing? The accepted answer to the question you link only explains how to disable the internal viewer and (I presume) assumes the user has a PDF viewer installed in his computer—but once away from the browser I can't believe you can trigger printing from a browser feature designed to print HTML. – Álvaro González Jun 14 '16 at 15:04
  • @ÁlvaroGonzález, thanks for your comment. See my update. – Igor Savinkin Jun 15 '16 at 06:20
  • @ÁlvaroGonzález, can you explain what you've written: *but once away from the browser I can't believe you can trigger printing from a browser feature designed to print HTML* – Igor Savinkin Jun 15 '16 at 06:20
  • Just a guess since I haven't tried it but... If your iframe contents are handled by a browser plug-in (or, even worse, an external program), can you still make `getMyFrame.contentWindow.print();` work? That was my concern about that answer. --- I've seen your update, it's clear now: you mean disabling Firefox builtin PDF viewer. – Álvaro González Jun 15 '16 at 08:17

0 Answers0