I would personally use pdf.js.

Does that meet your needs?
-Mark

On Thursday, November 26, 2015 at 3:01:50 PM UTC-6, Gael Princivalle wrote:
>
> Dear Leonel thanks a lot.
>
> I've tried also with stream without success.
> <object data=
> "/stream/memos.memo_file.ac5f12657d916e96.456c656e636f5f646f63756d656e74695f63616e7469657265312e706466.pdf#toolbar=1&amp;navpanes=0&amp;scrollbar=1&amp;page=1&amp;view=FitH"
>         type="application/pdf"
>         width="100%"
>         height="100%">
> </object>
>
> I've tried also in another website that display pdf files with absolute 
> pdf path, to display a downloaded file without success.
> Have you already tried to embed a downloaded pdf file?
>
>
> Il giorno martedì 24 novembre 2015 16:35:40 UTC+1, Leonel Câmara ha 
> scritto:
>>
>> I'm guessing the problem is that response.download sets 
>> Content-Disposition as an attachment. Make another controller function in 
>> default.py
>>
>> def stream():
>>     import re
>>     from pydal.exceptions import NotAuthorizedException, 
>> NotFoundException
>>
>>
>>     if not request.args:
>>         raise HTTP(404)
>>     name = request.args[-1]
>>     items = re.compile('(?P<table>.*?)\.(?P<field>.*?)\..*').match(name)
>>     if not items:
>>         raise HTTP(404)
>>     (t, f) = (items.group('table'), items.group('field'))
>>     try:
>>         field = db[t][f]
>>     except AttributeError:
>>         raise HTTP(404)
>>     try:
>>         (filename, stream) = field.retrieve(name, nameonly=True)
>>     except NotAuthorizedException:
>>         raise HTTP(403)
>>     except (NotFoundException, IOError):
>>         raise HTTP(404)
>>     return response.stream(stream)
>>
>> Note that this function could be made a lot simpler but I wanted it to 
>> work with uploadseparate=True and to work for any kind of file you want to 
>> stream.
>>
>> Now replace "download" with "stream" in your URL and you're done.
>>
>

-- 
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