[reportlab-users] Serving a PDF file (naming problem)

Tim Johnson reportlab-users@reportlab.com
Thu Nov 11 16:37:46 EST 2004


* Erik Stephens <erik@edgeos.com> [041111 00:16]:
> On Nov 10, 2004, at 5:28 PM, Tim Johnson wrote:
> 
> >I am using the following Function:
> >## code begins
> >def pdf_header(file_name,size):
> >    print (
> >        'Content-type: application/pdf\n\n'
> >        'Content-Length: %d\n'
> >        'Content-Disposition: inline; filename="%s"'
> >        ) % (size,file_name)
> 
> Don't end the Content-type line with two newlines.  In HTTP, two 
> newlines signals the end of headers.  You should be seeing the other 
> header lines in the file you downloaded.
 
  Sorry. Very confused here. If I remove one of those
  newlines, I get a server error.
  Message below:
  malformed header from script. Bad header=%PDF-1.3: kbServePDF.py

  That's why I added the second newline.
  Any ideas.
  Thanks
  tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com



More information about the reportlab-users mailing list