I have the following code ...


Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Dim fso, f, ts
Set fso = CreateObject("Scripting.FileSystemObject")

strPhyPath = Server.MapPath("/paysonnelCE/Misc/Bernard")

Set f = fso.GetFile(strPhyPath & "\test.pdf")

Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)

Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite ts.ReadAll
Response.Flush

the purpose is to stream a pdf to client... but all I get is the details,
ascii codes of the pdf ... anyway I can get a pdf instead of ascii text
display ?

Re: Output PDF by Tom

Tom
Tue Aug 26 08:09:21 CDT 2003

I believe the real problem is that a PDF requires the
Acrobat reader to interpret all of thos 'ascii codes' to
display it as it should be displayed. I think Mr. Goh is
trying too hard. All he needs to do is navigate to the
PDF for the reader to be invoked as an addin to the
browser or to be downloaded to the user, if the reader is
not present as an addin. For example, as an anchor in an
HTML ...

<html>
<body>
Read a pdf file here:<a
href=http://www.someserver.net/test.pdf>Test.PDF</a>
<body>
<html>

In any case, it definitely cannot be streamed to the user
in the manner proposed, regardless of the object(s) used
to read or write it.

Tom Lavedas
===========

>-----Original Message-----
>"Bernard Goh" <bghs312@hotmail.com> wrote in message
>news:%23MSvvl6aDHA.2580@TK2MSFTNGP12.phx.gbl...
>> I have the following code ...
>>
>>
>> Const ForReading = 1, ForWriting = 2, ForAppending = 8
>> Const TristateUseDefault = -2, TristateTrue = -1,
TristateFalse = 0
>> Dim fso, f, ts
>> Set fso = CreateObject("Scripting.FileSystemObject")
>>
>> strPhyPath = Server.MapPath
("/paysonnelCE/Misc/Bernard")
>>
>> Set f = fso.GetFile(strPhyPath & "\test.pdf")
>>
>> Set ts = f.OpenAsTextStream(ForReading,
TristateUseDefault)
>>
>> Response.Buffer = True
>> Response.ContentType = "application/pdf"
>> Response.BinaryWrite ts.ReadAll
>> Response.Flush
>>
>> the purpose is to stream a pdf to client... but all I
get is the details,
>> ascii codes of the pdf ... anyway I can get a pdf
instead of ascii text
>> display ?
>>
>The FileSystemObject is designed for text files, you may
have more luck with
>the adodb.stream class.
>--
>
>Joe
>
>
>.
>

Re: Output PDF by Joe

Joe
Wed Aug 27 04:12:56 CDT 2003

"Tom Lavedas" <tlavedas@hotmail.com> wrote in message
news:0cf901c36bd3$43c8a400$a401280a@phx.gbl...
> I believe the real problem is that a PDF requires the
> Acrobat reader to interpret all of thos 'ascii codes' to
> display it as it should be displayed. I think Mr. Goh is
> trying too hard. All he needs to do is navigate to the
> PDF for the reader to be invoked as an addin to the
> browser or to be downloaded to the user, if the reader is
> not present as an addin. For example, as an anchor in an
> HTML ...
>
> <html>
> <body>
> Read a pdf file here:<a
> href=http://www.someserver.net/test.pdf>Test.PDF</a>
> <body>
> <html>
>
> In any case, it definitely cannot be streamed to the user
> in the manner proposed, regardless of the object(s) used
> to read or write it.
>
> Tom Lavedas
> ===========
It depends, he wanted to obscure the actual file name. If you have a link
pointing to an asp file that reads the file, using the stream class for
instance, then BinaryWrite it to the browser it will appear in Acrobat
Reader. If you navigate to the page directly then the content will be
mis-interpreted. You can also put an object tag in the page:
object width="300" height="300"
clsid="clsid:{06849E9F-C8D7-4D59-B87D-784B7D6BE0B3}" data="streampdf.asp"

--

Joe