How can i open or download PDF file on Iphone using JS(Web application).
i am using window.open(src); it will work on android & all desktop OS. but not on Iphone.
i generate pdf file from server and want to print that file from cell phone. thats why i need to save pdf file or want to print directly from my web application.
Please HELP.!! Thanx in advance :)
Just make a function like following, and pass innerHTML.
openPrintWindow: function (printHtmlStr) { var me = this;
var dt = new Date().getTime(); var html = '<!DOCTYPE HTML>' + '<html>' + '<head>' + '<meta http-equiv="x-ua-compatible" content="IE=Edge"/>' + '<link rel="stylesheet" type="text/css" href="appRes/css/print.css?_dc=' + dt + '" media="all" />' + '</head>' + '<body>' + '<div class="print">' + printHtmlStr + '</div>'; html += '</body>'; html += '</html>'; var iframe = this._printIframe; if (!this._printIframe) { iframe = this._printIframe = document.createElement('iframe'); document.body.appendChild(iframe); iframe.style.display = 'none'; iframe.onload = function () { setTimeout(function () { iframe.focus(); iframe.contentWindow.print(); }, 1); }; } iframe.src = "about:blank"; var doc = iframe.contentWindow.document; var windowUrl = window.location; // iframe.contentWindow.location; var uniqueName = new Date(); var windowName = 'Print' + uniqueName.getTime(); this.testwindow = doc.open(windowUrl, windowName); doc.write(html); doc.close(); }