Click to See Complete Forum and Search --> : how to display a pdf file?


hcarousel
08-02-2005, 04:10 PM
I am creating a pdf file using asp. Now I want this pdf file displayed automatically in a browser window once it has been created. Can anybody tell me how to do that? Thanks

minority
08-03-2005, 03:13 AM
if its the actual pdf you want then you will pretty much need to make the user download it where they will get the option to open it or save it to my knowledge.

here is code to download it


<%
strFile= request("link")

dim ads, fso, f

Response.Buffer = True
Response.Clear

set ads = Server.CreateObject("ADODB.Stream")
ads.Open
ads.Type = 1

on error resume next
set fso = Server.CreateObject("Scripting.FileSystemObject")

set f = fso.GetFile(strFile)
intFilelength = f.size
ads.LoadFromFile(strFile)

if err then
Response.Write "<h1>Error: </h1><font color='#485e9e'>" & err.Description & "</font><p>"
Response.End
end if

Response.AddHeader "Content-Disposition", "attachment; filename=" & f.name
Response.AddHeader "Content-Length", intFilelength
Response.Charset = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite ads.Read
Response.Flush

ads.Close
set ads = Nothing
%>

chrismartz
08-03-2005, 09:39 AM
just put a link to the completed pdf file and it should load in any modern browser.

hcarousel
08-03-2005, 11:47 AM
just put a link to the completed pdf file and it should load in any modern browser.

I am new. Can you please tell me how to put the link? THanks!