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???
Thanks in advance.
--
Erik Myllymaki
er...@pacific-shores.com
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.
If your script had also sent a header of (warning: not 100% sure of
correct syntax, but that should be easy to check...):
Content-Disposition: attachment; filename=whatever.pdf
it should have fixed that (although, if I recall correctly, there
once was a bug with that with some Internet-Explorer sub-release;
but it's long been fixed by MS).
This one's a handly trick to keep in mind for any kind of filetype
that might be "registered" for special disposition on the user's
machine, by the way.
Alternatively, they could have fixed that on their end by setting
the preferences on their Acrobat Reader installation (removing the
"Web Integration" setting, if I recall correctly). Although this
is PDF-specific, only, it's also handy if, like me, you detest the
way Acrobat Reader work when it integrates itself with a browser:-).
Alex