coerrace
asked on
Save PDF and avoid the browser open
hello we have a windows server 2008 and we want the users download the PDF files when they click instead of open in the browser with acrobat reader. Is like a force to save and automatic downloading.
If you have examples of code we use ASP, javascript preference. We don't use PHP.
Thank you
If you have examples of code we use ASP, javascript preference. We don't use PHP.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you already have the pdf files created? Maybe you can post your code that you use to lay your pdf files and I can help you modify it
You have to add some header info. If you saw something in php, this is probably the similar solution in asp. http:Q_21929242.html#a17166603
ASKER
Big Monty this is what I have in code is a file in .html:
<SCRIPT>
function download()
{
window.open('file2.asp');
}
</SCRIPT>
<SPAN onmouseup='javascript:down load()'; style='cursor:pointer;disp lay:inline -block;whi te-space:n owrap;'><S PAN><TABLE onmouseover='this.classNam e="buttonb ack1o"' onmouseout='this.className ="buttonba ck1"'; class='buttonback1' cellspacing=0 cellpadding=0 height=100%;'><TH align=center valign=middle><SPAN style='white-space:nowrap; '><P class=buttontext>Download PDF</TH></TABLE></CENTER>< /SPAN></SP AN>
file2.asp is your code if you click mouse sends you to the page and display the content like text and not execute the VB code if I run the file.asp like http://xxx.xxx.xxx.xxx/file2.asp workks perfect download the file but we can't make http syntax we need to call in the same directory the .html it is we can't use http.
Thank you
<SCRIPT>
function download()
{
window.open('file2.asp');
}
</SCRIPT>
<SPAN onmouseup='javascript:down
file2.asp is your code if you click mouse sends you to the page and display the content like text and not execute the VB code if I run the file.asp like http://xxx.xxx.xxx.xxx/file2.asp workks perfect download the file but we can't make http syntax we need to call in the same directory the .html it is we can't use http.
Thank you
As a starting point, put the code I posted in its own file (displayPdf.asp) , and on the page that lists out the files, have them link to that page, along with the path listed in the query string so it would look like
Then on line 2, change it to
<a href ="displayPdf. asp? path=/PathToFile/filename.pdf">pdf name display</a>
Then on line 2, change it to
FPath = server.mappath(Request. QueryString("path") )
Just saw your post, have a) at mine and see if it works for you. Let me know if you have any additional questions
ASKER
Worked perfect running the html from www http and your code in same dir.
Thank you
Thank you
ASKER
Thank you