0

I am opening new window in that passing pdfurl. when i click print pdf, pdf document will open very nicely in new window. but when i do, newwindowInstance.print(); it is throughs error like this TypeError: 'undefined' is not a function (evaluating 'win.print()'). Below i have given code. Can any one tell me. how to resolve this issue. How print pdf from window print? Great appropriated. Thank you.

Code Here:

var win = window.open(speficationUrl, name);       
        setTimeout(function() {
            win.print();
            win.close();
        }, 5000);
Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126
Ramesh Lamani
  • 1,117
  • 3
  • 25
  • 54
  • 1
    Duplicate: http://stackoverflow.com/questions/687675/can-a-pdf-files-print-dialog-be-opened-with-javascript – Michal Rus Apr 24 '13 at 12:36
  • I have above link,But it is giving different error like Domains, protocols and ports must match. VesselPrintController.js:134TypeError: 'undefined' is not a function (evaluating 'getMyFrame.contentWindow.print()') Unsafe JavaScript attempt to access frame with URL http://www.gulfmark.com/_filelib/FileCabinet/pdfs/Enea.pdf from frame with URL file:///E:/GulfMark/trunk/Source/index.html. Domains, protocols and ports must match. VesselPrintController.js:134TypeError: 'undefined' is not a function (evaluating 'getMyFrame.contentWindow.print()'). code is Below. – Ramesh Lamani Apr 24 '13 at 13:07
  • var getMyFrame = document.getElementById('iframeId'); getMyFrame.focus(); getMyFrame.contentWindow.print(); – Ramesh Lamani Apr 24 '13 at 13:10
  • Possible duplicate of [Open PDF in a new window, print that PDF and Close the window. How to do this in javascript](http://stackoverflow.com/questions/7970318/open-pdf-in-a-new-window-print-that-pdf-and-close-the-window-how-to-do-this-in) – Paul Sweatte Jul 20 '16 at 21:51

0 Answers0