Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

How can we print new window opened in jquery .

JavaScript
 <script type="text/javascript">
      function PrintOnload(elementId) {

          if ($.browser.safari) {
              var page = window.open('@ViewBag.PDFPath');
              window.setTimeout(
           function () {
               page.print(); //happens 5 secs later
           },
           5000
       );


          }
</script>


In the script i am opening new window with my PDF content.
i need to print that new window after completely loaded.
but here it is printing Empty PDF.
How can i print that new window after loaded completely ?
Posted

1 solution

first check your pdf file path.
if its correct then add return false to PrintOnload function

C#
function PrintOnload(elementId) {

           if ($.browser.safari) {
               var page = window.open('@ViewBag.PDFPath');
               window.setTimeout(
            function () {
                page.print(); //happens 5 secs later
            },
            5000
        );
     return false;

           }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900