cgi to send PDF file to browser?

Richard van de Stadt -at home- richard at vandestadt.org
Thu Jul 20 08:49:48 EDT 2000


Erik Myllymaki wrote:
> 
> Hello,
> 
> I am looking for some advice on how to send a PDF file to a client browser
> from a cgi script. I could just show a listing of the directory where the
> PDF files are located and have the client select the right one, but for
> various reasons I would like to just ship it out transparently.
> 
> I have looked briefly at BaseHTTPServer, and I think this is where my answer
> lies???

What you basically need is to print the string "application/pdf" followed by
the contents of the pdf file.

I did that a few years ago, but went back to making links to the pdf files.
because too many users had problems configuring their browsers to work with
this. They just wanted to be able to download the files themselves by
clicking on the links.

Richard.



More information about the Python-list mailing list