Steaming PDF from Python Script to IE

Nathan Treloar ntreloar at
Mon Jun 23 02:23:00 CEST 2003

Thanks to everyone who responded with all this great information. 

It turns out that the automatic line endings were the problem. So:

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

doesn't work, but:

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


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


More information about the Python-list mailing list