Take a look to this

https://groups.google.com/forum/m/#!topic/web2py/qgmh5C0XXkY

El 26 feb. 2018 03:36, "Martin Weissenboeck" <[email protected]> escribió:

> Sorry, it does not work.
> The same results with or without "default"
>
> 2018-02-26 4:20 GMT+01:00 Marco Mansilla <[email protected]>:
>
>> This
>>
>> download = URL("download", args=p.pdf)
>>
>> Should be
>>
>> download = URL("default", "download", args=p.pdf)
>>
>> You can do that on the view. But the change on the controller should do.
>>
>> El 25 feb. 2018 15:54, "Martin Weissenboeck" <[email protected]>
>> escribió:
>>
>> What I want to do:
>>
>> I store a pdf-file in a database table.
>> Then I want to show this file.
>>
>> The model:
>>
>> db.define_table("pdfs",
>>     Field("pdf", "upload", uploadfield="pdfdata"),
>>     Field("description", "text"),
>>     Field("pdfdata","blob")
>> )
>>
>>
>>
>> The controller:
>>
>> def showpdf():
>>     id = int(request.args[0])
>>     p=db.pdfs(id)
>>     download = URL("download", args=p.pdf)
>>     return dict(p=p, download=download)
>>
>>
>>
>> The view:
>>
>> {{extend 'layout.html'}}
>> Description: {{=p.description}}
>> <br/>
>> <embed src="{{=download}}" type="application/pdf">
>>     <div>
>>         Cannot display embed
>>     </div>
>> </embed>
>> <br/><br/>
>> <iframe src="{{=download}}" type="application/pdf">
>>     <div>
>>         Cannot display iframe
>>     </div>
>> </iframe>
>>
>>
>>
>> ​The <embed> section show an error "Error on loading pdf".
>>
>> The <iframe> section shows an empty iframe and opens the Adobe Acrobat
>> Reader with the required pdf.
>>
>> Any ideas?
>>
>> Regards Martin
>>
>> --
>> Resources:
>> - http://web2py.com
>> - 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
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - 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
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Resources:
> - http://web2py.com
> - 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
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- 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 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to