Re: [web2py] embed a pdf

2018-02-26 Thread Martin Weissenboeck
Thank you - yes, I have tried a similar solution and it works.
It seems, that the "download function" does not work as expected.

2018-02-27 3:25 GMT+01:00 Raul Monares :

> I have this code that shows a PDF stored in a field "archivopdf" of table 
> "facturas". It is embedded in an iframe
>
> request.args(0) has the primary key
>
>
> def facturasprevista():
> facturas=db.facturas[request.args(0)]
> response.headers['Content-Type']='application/pdf'
> return facturas.archivopdf
>
>
> On Monday, February 26, 2018 at 12:35:14 AM UTC-7, mweissen wrote:
>>
>> Did not solve the problem. The pdf data is stored in the table (it can be
>> retrieved manually).
>> The question is how to show the pdf in an iframe or an embed field.
>>
>> 2018-02-26 8:00 GMT+01:00 Marco Mansilla :
>>
>>> Take a look to this
>>>
>>> https://groups.google.com/forum/m/#!topic/web2py/qgmh5C0XXkY
>>>
>>> El 26 feb. 2018 03:36, "Martin Weissenboeck" 
>>> escribió:
>>>
 Sorry, it does not work.
 The same results with or without "default"

 2018-02-26 4:20 GMT+01:00 Marco Mansilla :

> 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" 
> 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}}
> 
> 
> 
> Cannot display embed
> 
> 
> 
> 
> 
> Cannot display iframe
> 
> 
>
>
>
> ​The  section show an error "Error on loading pdf".
>
> The  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+un...@googlegroups.com.
> 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 web2py+un...@googlegroups.com.
> 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 web2py+un...@googlegroups.com.
 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 web2py+un...@googlegroups.com.
>>> 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 

Re: [web2py] embed a pdf

2018-02-26 Thread Raul Monares


I have this code that shows a PDF stored in a field "archivopdf" of table 
"facturas". It is embedded in an iframe

request.args(0) has the primary key


def facturasprevista():
facturas=db.facturas[request.args(0)]
response.headers['Content-Type']='application/pdf'
return facturas.archivopdf


On Monday, February 26, 2018 at 12:35:14 AM UTC-7, mweissen wrote:
>
> Did not solve the problem. The pdf data is stored in the table (it can be 
> retrieved manually).
> The question is how to show the pdf in an iframe or an embed field.
>
> 2018-02-26 8:00 GMT+01:00 Marco Mansilla  >:
>
>> Take a look to this
>>
>> https://groups.google.com/forum/m/#!topic/web2py/qgmh5C0XXkY
>>
>> El 26 feb. 2018 03:36, "Martin Weissenboeck" > > escribió:
>>
>>> Sorry, it does not work.
>>> The same results with or without "default"
>>>
>>> 2018-02-26 4:20 GMT+01:00 Marco Mansilla >> >:
>>>
 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"  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}}
 
 
 
 Cannot display embed
 
 
 
 
 
 Cannot display iframe
 
 



 ​The  section show an error "Error on loading pdf".

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


Re: [web2py] embed a pdf

2018-02-25 Thread Martin Weissenboeck
Did not solve the problem. The pdf data is stored in the table (it can be
retrieved manually).
The question is how to show the pdf in an iframe or an embed field.

2018-02-26 8:00 GMT+01:00 Marco Mansilla :

> Take a look to this
>
> https://groups.google.com/forum/m/#!topic/web2py/qgmh5C0XXkY
>
> El 26 feb. 2018 03:36, "Martin Weissenboeck" 
> escribió:
>
>> Sorry, it does not work.
>> The same results with or without "default"
>>
>> 2018-02-26 4:20 GMT+01:00 Marco Mansilla :
>>
>>> 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" 
>>> 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}}
>>> 
>>> 
>>> 
>>> Cannot display embed
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Cannot display iframe
>>> 
>>> 
>>>
>>>
>>>
>>> ​The  section show an error "Error on loading pdf".
>>>
>>> The  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.
>>>
>>>
>>> --
>>> 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.
>>>
>>
>>
>> --
>> 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.
>>
> --
> 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.
>

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


Re: [web2py] embed a pdf

2018-02-25 Thread Marco Mansilla
Take a look to this

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

El 26 feb. 2018 03:36, "Martin Weissenboeck"  escribió:

> Sorry, it does not work.
> The same results with or without "default"
>
> 2018-02-26 4:20 GMT+01:00 Marco Mansilla :
>
>> 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" 
>> 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}}
>> 
>> 
>> 
>> Cannot display embed
>> 
>> 
>> 
>> 
>> 
>> Cannot display iframe
>> 
>> 
>>
>>
>>
>> ​The  section show an error "Error on loading pdf".
>>
>> The  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.
>>
>>
>> --
>> 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.
>>
>
>
> --
> 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.
>

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


Re: [web2py] embed a pdf

2018-02-25 Thread Martin Weissenboeck
Sorry, it does not work.
The same results with or without "default"

2018-02-26 4:20 GMT+01:00 Marco Mansilla :

> 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" 
> 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}}
> 
> 
> 
> Cannot display embed
> 
> 
> 
> 
> 
> Cannot display iframe
> 
> 
>
>
>
> ​The  section show an error "Error on loading pdf".
>
> The  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.
>
>
> --
> 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.
>

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


Re: [web2py] embed a pdf

2018-02-25 Thread Marco Mansilla
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"  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}}



Cannot display embed





Cannot display iframe





​The  section show an error "Error on loading pdf".

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

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


[web2py] embed a pdf

2018-02-25 Thread Martin Weissenboeck
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}}



Cannot display embed





Cannot display iframe





​The  section show an error "Error on loading pdf".

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