I'm trying to open the PDF file for printing from captured url. I have tried window.open and pass the PDF url variable but the browser keeps downloading that PDF instead of opening in new tab, or opening in the Acrobat or for printing.
Then I have tried something like that:
On my source page:
<button onclick = "openForPrinting()" value = "Display">Print PDF</button>
my JS code:
var pdfFileUrl = url;
function openForPrinting()
{
myWindow=window.open("pdfwebpage.html");
myWindow.close;
}
And I have a new html page titled pdfwebpage.html
<html>
<head>
</head>
<body onload="window.print()">
<embed src=pdfFileUrl/> How to pass the PDF URL path here from the openForPrinting() function?
</body>
</html>
This almost worked, although I don't know how to pass the PDF url (pdfFileUrl) to the pdfwebpage.html page to be embedded.
Thanks for help.