1

I know there are some links and answers around here but they dont fit my problem... I have an open tab in a browser with a pdf to print and I want to close it automatically as soon as the user hits the 'OK' (print) button.

I know there are ways to use javascript onbeforeprint() and onafterprint() for this, but as you can imagine I it is impossible to call those from a pdf file :D - I see plugin for a browser as my best shot... Any ideas anybody?

kosta5
  • 1,129
  • 3
  • 14
  • 36

1 Answers1

0

why dont you set the PDF into an iframe and print it that way,

i have a work around for your print box close page issue.

<script>
  $(document).ready(function(){
        // timeout is used to give the browser a chance to load everything before executing the close
     setTimeout(function(){ window.close();},300);
          // before unload print the window, then the window closes if it was opened with window.open()
     $(window).bind("beforeunload",function(){
        window.print();
     });
  });
</script>

unless your using the browsers internal PDF viewer then, i'm at a loss.

Vtec
  • 1