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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to