0

Below is the code which i used but It doesn't print the pdf file.

 <script type="text/javascript">
     function CallPrint() {
            var pages = 'pdf url';
            var oWindow = window.open(pages, "print");
            oWindow.focus();
            self.print();
            oWindow.close();
             return false;


         }
    </script>
RekhaShanmugam
  • 101
  • 2
  • 5

1 Answers1

0

You can try the following code. Since the page(which is linked to by the CallPrint function) is already pdf format(I assume?), the browser will open the built in print feature and you will be able print out the pdf doc

$(document).ready(function() {
    function CallPrint(){
        window.print();
    };
 });

You will obviously have to bind the CallPrint function to a click function on the button link...eg.

<a href="CallPrint()">Print PDF</a>
DextrousDave
  • 6,603
  • 35
  • 91
  • 134