469,352 Members | 2,154 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Display PDF in the client browser

I am trying to display a PDF file in a client browser and get garbled
characters. Here is my code and please let me know if I am making any
mistake. The client machine has Adobe ACrobat (Full version installed)

Thanks
<%
dim objFSO, objTS
FileName = "c:\1.pdf"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(FileName)

NameFile=Right(FileName,Len(FileName)-InstrRev(FileName,"\"))

Response.ContentType = "application/pdf"

Response.Buffer = True
Do While Not objTS.AtEndOfStream
strChunk = objTS.Read(32)
strTmp = ""
For i = 1 to Len(strChunk)
strTmp = strTmp & ChrB(Asc(Mid(strChunk, i, 1)))
Next
Response.BinaryWrite strTmp
Response.Flush
Loop
objTS.Close
Set objTS = Nothing
Set objFSO = Nothing
%>
Jul 19 '05 #1
1 7173
"Saravana" <sv*********@quadrantsoftware.com> wrote in message
news:f7**************************@posting.google.c om...
I am trying to display a PDF file in a client browser and get garbled
characters. Here is my code and please let me know if I am making any
mistake. The client machine has Adobe ACrobat (Full version installed)

Thanks
<%
dim objFSO, objTS
FileName = "c:\1.pdf"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTS = objFSO.OpenTextFile(FileName)


Use ADODB.Stream instead of the FileSystemObject.
http://support.microsoft.com/?kbid=276488

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

19 posts views Thread by dmiller23462 | last post: by
33 posts views Thread by selowitch | last post: by
4 posts views Thread by Troy | last post: by
1 post views Thread by chazmanian | last post: by
2 posts views Thread by H. Rodriguez | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.