p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Reading PDF file


Message #1 by "Martin Bachorik" <bachorikm@a...> on Fri, 9 Mar 2001 14:30:50
I'm confused.  What do you mean you can't use response.redirect?
Why not?  And how is it that user's don't have access to the PDF files?

You should be able to just redirect to a PDF file.  Unless what you are
saying is that those files are accessible via a web address.  In that case,
you would have to open the PDF file as a file system object, then create a
HTML stream with a header indicating the document type (PDF, like you did
already) then response.write out the whole PDF file from the file system
object. That way users could access the PDF documents through a single page
with a URL of something like "getpdffile.asp?filename=somefile.pdf".
Seems like a lot of work when you could just put the PDFs in a web shared
directory.

Peter

-----Original Message-----
From: Martin Bachorik [mailto:bachorikm@a...]
Sent: Saturday, March 10, 2001 11:24 AM
To: How To
Subject: RE: Reading PDF file


Peter, I forgot to specifiy:
I can't use response.redirect, users doesn't have access to these files :-(
I have to find really something from server side ... but not download the
files.

Martin


> By using Server.Transfer, you are telling the server to process the .pdf
> file as a script (transferring execution).  It would probably be safer
and
> more correct to use a Redirect for that.  Seeing as how there probably
isn't
> much VBScript to process in a PDF file. ;-)
>
> Peter
>
> -----Original Message-----
> From: Martin Bachorik [mailto:bachorikm@a...]
> Sent: Friday, March 09, 2001 9:31 AM
> To: How To
> Subject: Reading PDF file
>
>
> Question:
>
> Response.ContentType = "application/pdf"
> Server.Transfer "pdf-file.pdf"
>
> is working nice, but only for PDF's not containing "<%" that type of
> characters...then you'll get error:
>
> Active Server Pages, ASP 0116 (0x80004005)
> The Script block lacks the close of script tag (%>).
>
> (W2K)
>
> Some ideas?


  Return to Index