I try to print pdf file in javaScript. I get the file's url from the server.
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.style.display = 'none';
iframe.src = urlBaseImage + 'Report//' + result;
iframe.focus();
iframe.contentWindow.print();
But he give me empty page, I checked the url and it is really correct. What Can I do? Thanks!
<iframe>? If you simply enter the PDF URL into the address bar of the broswer, is the PDF loaded as the page? If no to the previous two questions, then how are you confirming that the URL is correct? As a side note, as of Chrome 46,window.print()is blocked inside an<iframe>unless itssandboxattribute has the valueallow-modal.