On Apr 22, 2011, at 1:40 PM, Kenneth Lundström <[email protected]> 
wrote:

> Thank you for all your suggestions, the problem is that the PDF is created on 
> the fly, so when I click on a link I need to run a function and that function 
> creates the PDF and updates the database. After that I can reload the page 
> and open the PDF file in a new window. I guess the right order is to open the 
> PDF file and then with redirect "reload" the orginal page. But do I open a 
> new window from a function?
> 

The easiest, if it works for you, is target="_blank" in the clicked link. 
Otherwise think JavaScript; remember it's the browser that has to do the new 
window. You have to tell it somehow. 


> Any ideas?
> 
> 
> Kenneth
>> If you are using
>> 
>> def download():
>>     return response.download(request,db)
>> 
>> to download the PDF you can do
>> 
>> def download():
>>     return response.download(request,db,attachment=False)
>> 
>> and it will open in place (instead of downloading)
>> 
>> 
>> On Apr 18, 10:41 am, Anthony<[email protected]>  wrote:
>>> On Monday, April 18, 2011 11:01:51 AM UTC-4, pbreit wrote:
>>> 
>>>> How about (be careful with ' and "):
>>>> <a href="{{=URL('default','index')}}"
>>>> onclick='window.open("{{=URL("default","other")}}","mywindow");'>click
>>>> here</a>
>>> You might also have the href point to your PDF (and open in a new window via
>>> target="_blank"), and then reload the current page by adding:
>>> 
>>> onClick="window.location.reload()"
>>> 
>>> Anthony
> 

Reply via email to