redirect or reload page after pdf file generation.

1,532 views
Skip to first unread message

jai_python

unread,
Nov 3, 2009, 12:24:27 AM11/3/09
to Django users
Hello every one,

I have a form which contains group of data and I can select some of
them to take pdf file. When I submit the form, it returns pdf file
which contains the selected data. But i need to redirect or reload the
present form after pdf file has been generated inorder to remove
previous entry(i.e data included in the pdf file ) . Here goes my
source

def getPDF(request):
if not request.POST:
return to html form page
response = HttpResponse(mimetype='application/pdf')
#some content will be added to response with the use REPORTLAB
return response# will return pdf

This response will sent an pdf file to client side. same time i want
to reload or refresh after pdf file generation.


Thanks & Regards,
Jai

Jani Tiainen

unread,
Nov 3, 2009, 1:10:02 AM11/3/09
to django...@googlegroups.com
jai_python kirjoitti:

I don't think that such a mechanism exists in HTTP protocol so what
you're asking might not be really possible.

With little JS (ajax iframe download) you can achieve that kind of
refresh like functionality. But it relies on ajax functionality.

--
Jani Tiainen

jai_python

unread,
Nov 4, 2009, 11:43:12 AM11/4/09
to Django users
I save the response content in pdf file and then page will be
redirected and pdf file will be called on page onload

Thanks
Jai

bo liu

unread,
Nov 25, 2014, 3:28:31 AM11/25/14
to django...@googlegroups.com, jaya...@gmail.com
Hi, jai,
     Do you resolve this it? I have the same issue right now. Could you share your solution? thanks a lot.

Bo

Collin Anderson

unread,
Nov 26, 2014, 8:48:22 AM11/26/14
to django...@googlegroups.com, jaya...@gmail.com
Hi Bo,

One thing I've done is had the form redirect to a page saying "generating pdf", and then that page has a <meta http-equiv="refresh" content="5; url=/actual/pdf/?info_from_form">

Collin
Reply all
Reply to author
Forward
0 new messages