Hi All,
I have an asp program to show my PDF file in the browser. I have installed fulle Adobe Acrobat S/W including the reader.
But my browser showes unidentified characters in the browser with the following program which i saw from the internet. Please help me to sort it out.
Also I have tried the famous DownloadManager program in which my PDF files are forcing the dialogue to open the document.
Basically I want to view the PDF contents in the browser if acrobat reader is installed in the machine.
strFile=fileName "Here is my PDF file name
Dim FOLDER_PATH: FOLDER_PATH=Server.MapPath("\pdffolder")
If Right(FOLDER_PATH, 1)<>"\" Then FOLDER_PATH=FOLDER_PATH&"\"
strFile=FOLDER_PATH & strFile
' get full path of specified file
'strFilename = server.MapPath(strFile)
strFilename=strFile
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open
' Set as binary
s.Type = 1
' load in the file
on error resume next
' check the file exists
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
Response.End
end if
' get length of file
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
Response.End
end if
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/PDF"
' output the file to the browser
Response.BinaryWrite s.Read
Response.Flush
' tidy up
s.Close
Set s = Nothing
thanks in advance for your time.
I have an asp program to show my PDF file in the browser. I have installed fulle Adobe Acrobat S/W including the reader.
But my browser showes unidentified characters in the browser with the following program which i saw from the internet. Please help me to sort it out.
Also I have tried the famous DownloadManager program in which my PDF files are forcing the dialogue to open the document.
Basically I want to view the PDF contents in the browser if acrobat reader is installed in the machine.
strFile=fileName "Here is my PDF file name
Dim FOLDER_PATH: FOLDER_PATH=Server.MapPath("\pdffolder")
If Right(FOLDER_PATH, 1)<>"\" Then FOLDER_PATH=FOLDER_PATH&"\"
strFile=FOLDER_PATH & strFile
' get full path of specified file
'strFilename = server.MapPath(strFile)
strFilename=strFile
' clear the buffer
Response.Buffer = True
Response.Clear
' create stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open
' Set as binary
s.Type = 1
' load in the file
on error resume next
' check the file exists
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<h1>Error:</h1>" & strFilename & " does not exist<p>")
Response.End
end if
' get length of file
Set f = fso.GetFile(strFilename)
intFilelength = f.size
s.LoadFromFile(strFilename)
if err then
Response.Write("<h1>Error: </h1>" & err.Description & "<p>")
Response.End
end if
' send the headers to the users browser
Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/PDF"
' output the file to the browser
Response.BinaryWrite s.Read
Response.Flush
' tidy up
s.Close
Set s = Nothing
thanks in advance for your time.