So this is better (thanks to Paul Rykiel's post
re labels and responders including one Mariano Reingart)...
and hope it helps someone else down the road.
pdf = receipt_PDF()
rcpt_filename = "RCPT_%s_%s.pdf" % (session.rcpt_number, session.rcpt_recipient)
rcpt_filename = rcpt_filename.replace( ' ', '_' )
rcpt_filepath = request.folder + '/static/temp/%s'%(rcpt_filename)
if sys.platform.startswith( "linux" ) :
os.system( "xdg-open %s" %(rcpt_filepath) )
os.system( "%s" %(rcpt_filepath) )
response.headers['Content-Type'] = 'application/pdf'
return response.stream(rcpt_filepath, chunk_size=4096, request=request,
so this code...
- no longer opens the browser pdf reader, user page does not change!
- opens the open/save dialogue box with required filename and allowing
users to save wherever desired!
but it still has one issue...
- as well as opening the open/save dialogue box it automatically opens
Adobe Reader as well and displays the file (a little overkill!)
(It also creates temp files on the system that may/may not need to be
cleaned up - but that's for another day.)
*Can I stop it automatically opening the file in Adobe and if so how?*
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.