Steaming PDF from Python Script to IE

Nathan Treloar ntreloar at avaquest.com
Sat Jun 21 20:30:29 EDT 2003


I'm trying to stream PDF content to a browser client via a python CGI
script using:

    out = open("test.pdf", "rb").read()
    print 'Content-type: application/pdf\n\n'
    print out

However, IE is displaying the text and not launching Acrobat. If I
remove one '\n' on the Content-type header Acrobat is launched but is
not displaying the content. What am I missing? I've tried restarting
IE, flushing the cache, etc..

(You probably want to know why I don't just send a link to the file.
This is just a test, in my actual app the PDF content is coming from
another service as a byte stream.)

Thanks in advance.




More information about the Python-list mailing list