Have been outputting pdfs for a while and this is what works for me ...
note, I don't close the pdf pdf.close? but this allows the user to either open or save the file anywhere on their machine (Linux and Windows)
....
pdf.cell( ln=0, h=9.0, align='R', w=178.0, txt="%s %s" % (euro(), '{:10,.2f}'.format(inv_tot)), border=0 )
import os
import sys
if session.inv_print_type == 'ORIGINAL':
invc_filename = "INVC_%s_%s.pdf" % (session.inv_number,session.inv_company)
else:
invc_filename = "INVC_%s_%s_COPY.pdf" % (session.inv_number, session.inv_company)
invc_filename = invc_filename.replace(' ','_')
invc_filename = invc_filename.replace( '&', 'and')
s_io = pdf.output(dest='S')
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition'] = 'attachment; filename="%s"' % invc_filename
raise HTTP(200, s_io, **response.headers)