Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do I return a PDF document using ASP
Message
 
 
To
18/11/2001 21:15:18
Scott Butts
Ims Specialty Services
Twin Falls, Idaho, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00583294
Message ID:
00583860
Views:
22
This message has been marked as a message which has helped to the initial question of the thread.
Response.ContentType = "application/pdf"
pdffile = "c:\yourPDFfile.pdf"
set ado_stream = server.CreateObject("ADODB.Stream")
ado_stream.Type = 1 ' 1=adTypeBinary
ado_stream.Open()
ado_stream.LoadFromFile(pdffile)
response.binaryWrite ado_stream.Read(-1)
ado_stream.Close()

>does anyone have a simple sample of some asp code to read a pdf document from the hard drive and send it back to the browser? I have tried but it keeps says tha the document is currupt and can't be repaired.
>
>I set the contenttype to application/pdf and read the file from the hard drive using the Scripting.FileSystemObject and a call to OpenTextFile and ReadAll on the object returned after opening the file. I tried to post the code but kept doing something incorrect and it wasn't accepted. The last thing I do is a Response.write() the result of the ReadAll.
>
>Anyone have any suggestions? I have been looking all over the place and can't seem to find any code that will help me complete this simple task.
>
>Thanks for any input
>Scott
Michael McLain
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform