Steaming PDF from Python Script to IE
Erik Max Francis
max at alcyone.com
Sun Jun 22 20:56:01 EDT 2003
Nathan Treloar wrote:
> ... doesn't work, but:
>
> out = open("test.pdf", "rb").read()
> print 'Content-type: application/pdf\n\n',
> print out,
>
> and
>
> out = open("test.pdf", "rb").read()
> sys.stdout.write('Content-type: application/pdf\n\n')
> sys.stdout.write(out)
>
> work.
It's really just luck that the first one works; if it were a true binary
format (one that wasn't insensitive to whitespace padding), the first
form wouldn't work either. (It inserts spaces before and after the PDF
data.)
--
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Nothing is potent against love save impotence.
\__/ Samuel Butler
More information about the Python-list
mailing list