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

Tim Johnson reportlab-users@reportlab.com
Thu Nov 11 00:28:05 EST 2004


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)
## code ends
A cgi program which is running from my computer as
http://localhost/cgi-bin/baker/kbServePDF.py
makes a call as a follows
pdf_header('my_ad.pdf',1) 
When I click on a link to the cgi program from
Netscape (on Linux) The prompt is to save or
open the virtual document as "kbServePDF.py",
rather than "my_ad.pdf".

The issue is similar on Internet Explorer: IE
wants to save the file as kbServePDF, and if I choose
the "All Files" option from the dialogue window,
It is saved as "kbServePDF.pdf".

My question is:
  How can I get the browsers to "serve" the documents
  as 'my_ad.pdf'?

Thanks In advance.
Pointers to documentation is welcome and appreciated.
tim

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



More information about the reportlab-users mailing list