Re: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread mostwanted
Thanks

On Tuesday, January 28, 2020 at 4:19:42 PM UTC+2, John Bannister wrote:
>
> If you don’t want the field to be displayed in the SQLFORM() you need to 
> set as follows:
>
> db.table.fieldname.readable = db.table.fieldname.writable=False before the 
> form initialisation.
>
>  
>
> So something like :-
>
> db.dog.owner.readable=db.dog.owner.writable=False
>
> form = SQLFORM(db.dog)
>
> if form.process().accepted:
>
> …..
>
> ….
>
> return dict(form=form)
>
>  
>
> *From:* web...@googlegroups.com  [mailto:
> web...@googlegroups.com ] *On Behalf Of *António Ramos
> *Sent:* 28 January 2020 14:49
> *To:* web...@googlegroups.com 
> *Subject:* Re: [web2py] Displaying only certain fields of choice with 
> SQLFORM(...) update
>
>  
>
> did you also tried writable=False 
>
> When a field is marked with writable=False, the field is not shown in 
> create forms, and it is shown readonly in update forms. If a field is 
> marked as writable=False and readable=False, then the field is not shown 
> at all, not even in update forms. 
>
>  
>
> db.table.var.readable= db.table.var.writable=False 
>
>  
>
> Em ter., 28 de jan. de 2020 às 13:21, mostwanted  > escreveu:
>
> I did employ this method (db.quotation.beforeVat.readable=False!!! ) in my 
> controller but it didnt respond, its actually the first thing i tried! Its 
> just that i was hoping SQLFORM() may have some helpers as part of its 
> signature that i dont know about that I could use.
>
> On Tuesday, January 28, 2020 at 12:50:31 PM UTC+2, Ramos wrote:
>
> Look in the docs 
>
>  
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators 
>
> in your controller before showing your form,
>
>  
>
> db.yourtable.yourfield.readable=False!!! 
>
>  
>
> Em ter., 28 de jan. de 2020 às 10:29, mostwanted  
> escreveu:
>
> I was wondering if there is a way to show the SQLFORM() with only certain 
> fields for the user during a form update & not show all the fields. 
> SQLFORM.grid(...) has the field=None argument which enables one to select 
> the fields to be displayed in the view, is there something like that for 
> SQLFORM()?
>
> I have some fields which only do calculations in my db tables & those are 
> the fields I wanna hide during updates.
>
>  
>
> Regards;
>
>  
>
> Mostwanted
>
> -- 
> 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 web...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
>  
> 
> .
>
> -- 
> 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 web...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/0320799e-d6df-4e35-880e-26b902511278%40googlegroups.com
>  
> 
> .
>
> -- 
> 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 web...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/web2py/CAEM0BxPAez734JH9mwpBbKkecjV5WS6dKSJMTbDEB5Q9HrUyEw%40mail.gmail.com
>  
> 
> .
>

-- 
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.
To view this discussion on the web visit 

Re: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread mostwanted
Thank you, I overlooked that.

On Tuesday, January 28, 2020 at 3:49:02 PM UTC+2, Ramos wrote:
>
> did you also tried writable=False 
> When a field is marked with writable=False, the field is not shown in 
> create forms, and it is shown readonly in update forms. If a field is 
> marked as writable=False and readable=False, then the field is not shown 
> at all, not even in update forms. 
>
> db.table.var.readable= db.table.var.writable=False 
>
> Em ter., 28 de jan. de 2020 às 13:21, mostwanted  > escreveu:
>
>> I did employ this method (db.quotation.beforeVat.readable=False!!! ) in 
>> my controller but it didnt respond, its actually the first thing i tried! 
>> Its just that i was hoping SQLFORM() may have some helpers as part of its 
>> signature that i dont know about that I could use.
>>
>> On Tuesday, January 28, 2020 at 12:50:31 PM UTC+2, Ramos wrote:
>>>
>>> Look in the docs 
>>>
>>> http://web2py.com/books/default/chapter/29/07/forms-and-validators 
>>> in your controller before showing your form,
>>>
>>> db.yourtable.yourfield.readable=False!!! 
>>>
>>> Em ter., 28 de jan. de 2020 às 10:29, mostwanted  
>>> escreveu:
>>>
 I was wondering if there is a way to show the SQLFORM() with only 
 certain fields for the user during a form update & not show all the 
 fields. 
 SQLFORM.grid(...) has the field=None argument which enables one to select 
 the fields to be displayed in the view, is there something like that for 
 SQLFORM()?
 I have some fields which only do calculations in my db tables & those 
 are the fields I wanna hide during updates.

 Regards;

 Mostwanted

 -- 
 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 web...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
  
 
 .

>>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/0320799e-d6df-4e35-880e-26b902511278%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/5f295ec4-9af9-4927-a9e1-b7ba9b6031a2%40googlegroups.com.


RE: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread John Bannister
If you don’t want the field to be displayed in the SQLFORM() you need to set as 
follows:

db.table.fieldname.readable = db.table.fieldname.writable=False before the form 
initialisation.

 

So something like :-

db.dog.owner.readable=db.dog.owner.writable=False

form = SQLFORM(db.dog)

if form.process().accepted:

…..

….

return dict(form=form)

 

From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of 
António Ramos
Sent: 28 January 2020 14:49
To: web2py@googlegroups.com
Subject: Re: [web2py] Displaying only certain fields of choice with 
SQLFORM(...) update

 

did you also tried writable=False 

When a field is marked with writable=False, the field is not shown in create 
forms, and it is shown readonly in update forms. If a field is marked as 
writable=False and readable=False, then the field is not shown at all, not even 
in update forms. 

 

db.table.var.readable= db.table.var.writable=False 

 

Em ter., 28 de jan. de 2020 às 13:21, mostwanted  
escreveu:

I did employ this method (db.quotation.beforeVat.readable=False!!! ) in my 
controller but it didnt respond, its actually the first thing i tried! Its just 
that i was hoping SQLFORM() may have some helpers as part of its signature that 
i dont know about that I could use.

On Tuesday, January 28, 2020 at 12:50:31 PM UTC+2, Ramos wrote:

Look in the docs 

 

http://web2py.com/books/default/chapter/29/07/forms-and-validators 

in your controller before showing your form,

 

db.yourtable.yourfield.readable=False!!! 

 

Em ter., 28 de jan. de 2020 às 10:29, mostwanted  escreveu:

I was wondering if there is a way to show the SQLFORM() with only certain 
fields for the user during a form update & not show all the fields. 
SQLFORM.grid(...) has the field=None argument which enables one to select the 
fields to be displayed in the view, is there something like that for 
SQLFORM()?

I have some fields which only do calculations in my db tables & those are the 
fields I wanna hide during updates.

 

Regards;

 

Mostwanted

-- 
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 web...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
 

 .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0320799e-d6df-4e35-880e-26b902511278%40googlegroups.com
 

 .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxPAez734JH9mwpBbKkecjV5WS6dKSJMTbDEB5Q9HrUyEw%40mail.gmail.com
 

 .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/013601d5d5e5%24f583cba0%24e08b62e0%24%40gmail.com.


Re: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread António Ramos
did you also tried writable=False
When a field is marked with writable=False, the field is not shown in
create forms, and it is shown readonly in update forms. If a field is
marked as writable=False and readable=False, then the field is not shown at
all, not even in update forms.

db.table.var.readable= db.table.var.writable=False

Em ter., 28 de jan. de 2020 às 13:21, mostwanted 
escreveu:

> I did employ this method (db.quotation.beforeVat.readable=False!!! ) in my
> controller but it didnt respond, its actually the first thing i tried! Its
> just that i was hoping SQLFORM() may have some helpers as part of its
> signature that i dont know about that I could use.
>
> On Tuesday, January 28, 2020 at 12:50:31 PM UTC+2, Ramos wrote:
>>
>> Look in the docs 
>>
>> http://web2py.com/books/default/chapter/29/07/forms-and-validators
>> in your controller before showing your form,
>>
>> db.yourtable.yourfield.readable=False!!!
>>
>> Em ter., 28 de jan. de 2020 às 10:29, mostwanted 
>> escreveu:
>>
>>> I was wondering if there is a way to show the SQLFORM() with only
>>> certain fields for the user during a form update & not show all the fields.
>>> SQLFORM.grid(...) has the field=None argument which enables one to select
>>> the fields to be displayed in the view, is there something like that for
>>> SQLFORM()?
>>> I have some fields which only do calculations in my db tables & those
>>> are the fields I wanna hide during updates.
>>>
>>> Regards;
>>>
>>> Mostwanted
>>>
>>> --
>>> 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 web...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
>>> 
>>> .
>>>
>> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/0320799e-d6df-4e35-880e-26b902511278%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxPAez734JH9mwpBbKkecjV5WS6dKSJMTbDEB5Q9HrUyEw%40mail.gmail.com.


Re: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread mostwanted
I did employ this method (db.quotation.beforeVat.readable=False!!! ) in my 
controller but it didnt respond, its actually the first thing i tried! Its 
just that i was hoping SQLFORM() may have some helpers as part of its 
signature that i dont know about that I could use.

On Tuesday, January 28, 2020 at 12:50:31 PM UTC+2, Ramos wrote:
>
> Look in the docs 
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators 
> in your controller before showing your form,
>
> db.yourtable.yourfield.readable=False!!! 
>
> Em ter., 28 de jan. de 2020 às 10:29, mostwanted  > escreveu:
>
>> I was wondering if there is a way to show the SQLFORM() with only certain 
>> fields for the user during a form update & not show all the fields. 
>> SQLFORM.grid(...) has the field=None argument which enables one to select 
>> the fields to be displayed in the view, is there something like that for 
>> SQLFORM()?
>> I have some fields which only do calculations in my db tables & those are 
>> the fields I wanna hide during updates.
>>
>> Regards;
>>
>> Mostwanted
>>
>> -- 
>> 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 web...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/0320799e-d6df-4e35-880e-26b902511278%40googlegroups.com.


Re: [web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread António Ramos
Look in the docs 

http://web2py.com/books/default/chapter/29/07/forms-and-validators
in your controller before showing your form,

db.yourtable.yourfield.readable=False!!!

Em ter., 28 de jan. de 2020 às 10:29, mostwanted 
escreveu:

> I was wondering if there is a way to show the SQLFORM() with only certain
> fields for the user during a form update & not show all the fields.
> SQLFORM.grid(...) has the field=None argument which enables one to select
> the fields to be displayed in the view, is there something like that for
> SQLFORM()?
> I have some fields which only do calculations in my db tables & those are
> the fields I wanna hide during updates.
>
> Regards;
>
> Mostwanted
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAEM0BxNr3nWNi8XHJtZRJ8znpn7Np1Mztn04Ri2bpz6x0i9%3DbQ%40mail.gmail.com.


[web2py] Displaying only certain fields of choice with SQLFORM(...) update

2020-01-28 Thread mostwanted
I was wondering if there is a way to show the SQLFORM() with only certain 
fields for the user during a form update & not show all the fields. 
SQLFORM.grid(...) has the field=None argument which enables one to select 
the fields to be displayed in the view, is there something like that for 
SQLFORM()?
I have some fields which only do calculations in my db tables & those are 
the fields I wanna hide during updates.

Regards;

Mostwanted

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/281ed3a3-66df-4eae-8768-1b9618c6093a%40googlegroups.com.


[web2py] Re: Saving a view as an file/image

2020-01-28 Thread Dave S


On Sunday, January 26, 2020 at 11:04:43 AM UTC-8, Scott Hunter wrote:
>
> The FPDF module has an HTML Renderer which you might find useful.
>
> - Scott
>

I haven't looked into that feature (that I know of), but from my previous 
experience with FPDF I would probably have started with doing the PDF from 
scratch, and then display the PDF on the page.

/dps


> On Sunday, January 26, 2020 at 9:25:47 AM UTC-5, John Bannister wrote:
>>
>> Hi All,
>>
>> I have hit a bit of a stumbling block and would like to know if anyone 
>> else has come across this and how to resolve it.
>>
>> Situation is as follows:-
>>
>> I am generating tickets/coupons for users once they have entered all the 
>> appropriate info which I am doing via normal controller/view using html for 
>> styling. Coupon consists of 2 images plus some text (nothing really fancy 
>> at all).
>>
>> Everything looks okay and as it should in the view with all the correct 
>> information etc.
>>
>> I now what to email the coupon to the user. This is where I am a bit 
>> stumped.
>>
>> I am assuming that I will need to save the rendered view as an 
>> image/file/.pdf if I want the styling, logos, qrcodes etc to be in the 
>> email that I will send as well as for all the formatting to be as per the 
>> view.
>>
>> Is there any easy way or any way at all to do this?
>>
>> In the controller I can use the response.render(view, args) but still 
>> cant see how to create a pdf file from the actual view before sending the 
>> email.
>> Hopefilly I ma missing something simple  
>>
>> Thanks in advance 
>>
>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/c8bb57c9-9bc7-493e-aef9-54d1e4c47316%40googlegroups.com.


RE: [web2py] Re: Saving a view as an file/image

2020-01-28 Thread John Bannister
Hey thanks a lot will try it out!!

 

From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of 
mostwanted
Sent: 27 January 2020 15:47
To: web2py-users
Subject: [web2py] Re: Saving a view as an file/image

 

Hey John, I dont know if this will help you but there was a time when i needed 
to convert a view to PDF & I used 2 l js libraries, html2canvas & jsPDF, they 
enabled me to achieve my goal that time, you can find the jsPDF package here: 
https://github.com/MrRio/jsPDF   


and the html2canvas package here: 
https://github.com/niklasvh/html2canvas/releases

After extracting all the files from the compressed folders look for these 2 js 
files in jsPDF;  jspdf.debug.js, jspdf.min.js, and the html2canvas.js in the 
html2pdf folder, upload them into your application's static/js directory, from 
there call them in your application's layout page like this:






 

In the view that you want to convert to PDF have this javascript code:


function genPDF()
{
let pdfName = "licencia";
var doc = new jsPDF({
format: "a4"
});

  html2canvas(document.getElementById("invoicing"), {
scale: "5"
  }).then(canvas => {
console.log("Capturando");
this.imgFile = canvas;
doc.addImage(this.imgFile, "JPEG", 5, 5, 200, 250);
doc.save('filename.pdf');
  });
}


 

In the same view have a link that when clicked calls the above js function like 
this:

Click to Download as PDF


This should convert you view into PDF or Image as per the usage of both 
liraries.

 

I hope the maintainers of the jsPDF & html2pdf libraries have not made 
adjustmets that may cause this not to work;

 

Regards

 

Mostwanted



On Sunday, January 26, 2020 at 4:25:47 PM UTC+2, John Bannister wrote:

Hi All,

 

I have hit a bit of a stumbling block and would like to know if anyone else has 
come across this and how to resolve it.

 

Situation is as follows:-

 

I am generating tickets/coupons for users once they have entered all the 
appropriate info which I am doing via normal controller/view using html for 
styling. Coupon consists of 2 images plus some text (nothing really fancy at 
all).

 

Everything looks okay and as it should in the view with all the correct 
information etc.

 

I now what to email the coupon to the user. This is where I am a bit stumped.

 

I am assuming that I will need to save the rendered view as an image/file/.pdf 
if I want the styling, logos, qrcodes etc to be in the email that I will send 
as well as for all the formatting to be as per the view.

 

Is there any easy way or any way at all to do this?

 

In the controller I can use the response.render(view, args) but still cant see 
how to create a pdf file from the actual view before sending the email.

Hopefilly I ma missing something simple  

 

Thanks in advance 

 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7643b84a-9fa5-490a-9a47-d5775f859b27%40googlegroups.com
 

 .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/00b701d5d5b8%2491584e80%24b408eb80%24%40gmail.com.


RE: [web2py] Re: Saving a view as an file/image

2020-01-28 Thread John Bannister
I have no issue styling the vouchers in HTML  (this is already done in a view) 
my issue  is how to capture that view and send it via email either as message 
or attachment.

 

From: web2py@googlegroups.com [mailto:web2py@googlegroups.com] On Behalf Of 
villas
Sent: 27 January 2020 13:26
To: web2py-users
Subject: [web2py] Re: Saving a view as an file/image

 

Generating PDFs can be a challenge, so it would be much easier to style the 
vouchers in HTML.

 

Re: QRcodes.  You can even generate QRcodes using Markmin, or, just use the 
Google Charts API directly. Search web for other solutions.

 

 


On Sunday, 26 January 2020 14:25:47 UTC, John Bannister wrote:

Hi All,

 

I have hit a bit of a stumbling block and would like to know if anyone else has 
come across this and how to resolve it.

 

Situation is as follows:-

 

I am generating tickets/coupons for users once they have entered all the 
appropriate info which I am doing via normal controller/view using html for 
styling. Coupon consists of 2 images plus some text (nothing really fancy at 
all).

 

Everything looks okay and as it should in the view with all the correct 
information etc.

 

I now what to email the coupon to the user. This is where I am a bit stumped.

 

I am assuming that I will need to save the rendered view as an image/file/.pdf 
if I want the styling, logos, qrcodes etc to be in the email that I will send 
as well as for all the formatting to be as per the view.

 

Is there any easy way or any way at all to do this?

 

In the controller I can use the response.render(view, args) but still cant see 
how to create a pdf file from the actual view before sending the email.

Hopefilly I ma missing something simple  

 

Thanks in advance 

 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/020c2eb9-f2b9-494e-901d-8990853b79d7%40googlegroups.com
 

 .

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/00aa01d5d5b8%2435a34950%24a0e9dbf0%24%40gmail.com.