[web2py] Re: Reportlab add image to pdf

2016-03-18 Thread Edwood


The error message suggests the script cannot find the image in that 
folder.  Using pyFPDF this is how I will build the path using 
"os.path.join":

 os.path.join(request.folder,'static/images', 'logounca.png')

On Friday, March 18, 2016 at 8:53:11 PM UTC-4, Winter Kryz wrote:
>
> I tried the os.path.join but didn't work. Can someone help me with this, 
> please?
>
>

-- 
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] Re: Add field with button on SQLFORM

2015-04-20 Thread Edwood

You may start looking at this code 
http://www.web2pyslices.com/slice/show/1616/widget-select-or-add-option-ng 
and build your solution from there.


On Friday, April 17, 2015 at 10:50:40 PM UTC-4, KevC wrote:
>
> Hi community!
> Good afternoon, my name is Kevin. 
> I want to know if you could help me. I started to use web2py, but I don't 
> know some things. 
> I want to create fields with a button on SQLFORM and HTML. For example, I 
> have author table and book table, but a book can get several authors and I 
> need to create differents "INPUT" for save them with book and his fields.
> I have a relation many to many between book and author. Also, I have 
> combined author and book FORM´s.
>
>
> I wanna this form:
>
>
> Title: |___
> Name author: |___ + -(Where '+', I wanna use it for add more 
> authors in the same form and save them in his respective tables and '-' use 
> it for remove fields If I mistake)
> Lenguaje:  |
> ISBN:   |
> Etc.
>
>
>
>
> I hope you can help me.
> Greetings.
>

-- 
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] Installing web2py in IIS 8.5 wwwroot subfolder

2018-03-23 Thread Edwood
I have been successful installing web2py inside "\Inetpub\wwwroot" as the 
web2py deployment recipe and other resources instruct.  But what I am 
trying to accomplish is to run it from "\Inetpub\wwwroot\web2py".

What I am trying to avoid is too fill wwwroot with python files since there 
are many ASP .Net sites already installed in that server.  I want to be 
careful and not interfere with the operation of those sites.

I suspect I should make changes in the web.config file, but I have not 
found references to help me with that.

My setup: Windows Server 2012R2, IIS 8.5, latest web2py 2.16.1-stable

Any pointers will be appreciated.

-- 
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] Re: Installing web2py in IIS 8.5 wwwroot subfolder

2018-03-27 Thread Edwood
I just ended installing in a different folder outside of Inetpub an it 
worked.


On Friday, March 23, 2018 at 7:05:37 PM UTC-4, Edwood wrote:
>
> I have been successful installing web2py inside "\Inetpub\wwwroot" as the 
> web2py deployment recipe and other resources instruct.  But what I am 
> trying to accomplish is to run it from "\Inetpub\wwwroot\web2py".
>
> What I am trying to avoid is too fill wwwroot with python files since 
> there are many ASP .Net sites already installed in that server.  I want to 
> be careful and not interfere with the operation of those sites.
>
> I suspect I should make changes in the web.config file, but I have not 
> found references to help me with that.
>
> My setup: Windows Server 2012R2, IIS 8.5, latest web2py 2.16.1-stable
>
> Any pointers will be appreciated.
>
>

-- 
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] Re: FPDF

2016-12-31 Thread Edwood
Hi!

If you are using FPDF's templates you can treat each page as a different 
template and then use the PyPDF2 library and its objects PdfFileMerger and 
PdfFileReader to merge all the pages in a single document.



On Wednesday, December 28, 2016 at 9:30:05 PM UTC-4, Áureo Dias Neto wrote:
>
> Good night,
>
> How i'm add a new page, and set new content to this, on pdf, with fpdf?
>
> I use pdf.add_page(), but the content o the second page is the same as the 
> first..
>

-- 
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] Re: FPDF

2017-01-02 Thread Edwood
Happy new year to you too! 

Can you post the code? It will be easier to understand the problem. 

-- 
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] Re: FPDF

2017-01-06 Thread Edwood
It should work unless there is something in the HTML markup messing with 
the output.  I tried this similar code with file output instead of stream 
and it did what you expected (as I understood it):

from gluon.contrib.pyfpdf import FPDF, HTMLMixin
from datetime import datetime

class MyFPDF(FPDF, HTMLMixin):
def header(self):
self.set_title("Analise de Valores")
self.set_font('Arial', '', 15)
self.cell(0, 10, "title", 0, 0, 'L')
self.cell(0, 10, '%s VEICULOS' % "50", 0, 0, 'R')
self.line(287, 18, 10, 18)

def footer(self):
self.set_y(-15)
self.set_font('Arial', 'I', 8)
txt = 'Folha %s de %s' % (self.page_no(), self.alias_nb_pages())
self.cell(0, 10, txt, 0, 0, 'C')
self.set_y(-15)
self.set_font('Arial', 'I', 10)
Useratual="auth.user"
#Useratual = Useratual.first_name + ' ' + Useratual.last_name
#Useratual = Useratual.decode("utf-8")
data = datetime.now().strftime('%d/%m/%Y - %H:%M')
self.cell(0, 20, 'Impresso por: %s (%s)' % (Useratual,"data"), 0, 0, 
'C')

pdf = MyFPDF('L')
pdf.add_page('L')
#pdf.write_html( str(XML(table, sanitize=True)).decode("utf-8"))

# First page
pdf.write_html('1st Page')
pdf.write_html('12TEST 1TEST 2TEST 3TEST 
4footer 1footer 1')

# Second page
pdf.add_page('L')
pdf.write_html('2nd Page')
pdf.write_html('1020TEST 5TEST 6TEST 7TEST 
 8footer 2footer 2')

# Third page
pdf.add_page('L')
pdf.write_html('3rd Page')
pdf.write_html('100200TEST 9TEST 10TEST 11TEST 
 12footer 3footer 3')
#response.headers['Content-Type'] = 'application/pdf'
pdf.output("multihtml.pdf", dest='F')

I attached the PDF output (multihtml.pdf). Compare with your table's HTML.


On Monday, January 2, 2017 at 9:53:24 PM UTC-4, Áureo Dias Neto wrote:
>
> Hello, it's basically this:
>
> i want another page with another content, in the same function or document 
> pdf
>
> from gluon.contrib.pyfpdf import FPDF, HTMLMixin
>
> class MyFPDF(FPDF, HTMLMixin):
> def header(self):
> self.set_title("Analise de Valores")
> self.set_font('Arial', '', 15)
> self.cell(0, 10, response.title, 0, 0, 'L')
> self.cell(0, 10, '%s VEICULOS' % registros, 0, 0, 'R')
> self.line(287, 18, 10, 18)
>
> def footer(self):
> self.set_y(-15)
> self.set_font('Arial', 'I', 8)
> txt = 'Folha %s de %s' % (self.page_no(), self.alias_nb_pages())
> self.cell(0, 10, txt, 0, 0, 'C')
> self.set_y(-15)
> self.set_font('Arial', 'I', 10)
> Useratual=auth.user
> Useratual = Useratual.first_name + ' ' + Useratual.last_name
> Useratual = Useratual.decode("utf-8")
> data = datetime.now().strftime('%d/%m/%Y - %H:%M')
> self.cell(0, 20, 'Impresso por: %s (%s)' % (Useratual,data), 0, 0, 'C')
>
> pdf = MyFPDF('L')
> pdf.add_page('L')
> #pdf.write_html( str(XML(table, sanitize=True)).decode("utf-8"))
> pdf.write_html('' + table.xml().decode('utf-8') + '')
> pdf.add_page('L')
> pdf.write_html('' + tabela_totais.xml().decode('utf-8') + 
> '')
> response.headers['Content-Type'] = 'application/pdf'
> return pdf.output(dest='S')
>
> 2017-01-02 21:20 GMT-02:00 Edwood >:
>
>> Happy new year to you too!
>>
>> Can you post the code? It will be easier to understand the problem.
>>
>> --
>> 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.


multihtml.pdf
Description: Adobe PDF document


[web2py] Re: pypfdf - how to make text wrap table cells?

2015-09-05 Thread Edwood
Hi.

Wrapping inside table columns is not currently supported by "write_html", 
nor are CSS properties.  

One way to render wrapped text inside tables is to build the table using 
lines and then use "multi_cell" to wrap text inside the columns.  This 
technique will require you to maintain careful track of the current 
position inside de PDF document.  Some examples that may help you 
(disclaimer: wrote by me):

   - Wrapping with multi_cell: 
   https://pyfpdfbook.wordpress.com/2015/03/22/wrapping-text-with-multicell/
   

   - Putting two adjacent multicell blocks: 
   
https://pyfpdfbook.wordpress.com/2015/03/22/putting-two-adjacent-multicell-blocks/

 You may also try Weasyprint (http://weasyprint.org/) which supports CSS 
styles.  I have no experience with it yet, but looks interesting.


On Thursday, September 3, 2015 at 6:43:40 AM UTC-4, at wrote:
>
> Hi,
>
> I was trying to use the first sample report from: 
> https://code.google.com/p/pyfpdf/wiki/Web2Py. I modified it a little to 
> fill the data dynamically inside the table, but the long text is not 
> wrapping inside the table cells. I've tried setting different css to 
> address the issue but no luck. 
>
> Any idea how to fix it?
>
> Thanks a lot.  
>
>

-- 
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] Re: Problems with fpdf

2015-11-28 Thread Edwood
I am not having that problem when testing your code with pyfpdf 1.7.2, 
using the same font.  I noticed web2py 2.12.3 is still using pyfpdf 1.7.1.  
I recommend temporarily replacing pyfpdf folder with new version an try 
again.

On Saturday, November 28, 2015 at 1:46:12 PM UTC-4, mweissen wrote:
>
> Hi, I have tried again to use fpdf.
>
> *1st try:*
>
> from gluon.contrib.fpdf import FPDF
>
> def test():
> pdf = FPDF('P', 'mm', 'A4')
> pdf.add_page()
> pdf.set_font('Arial', 'B', 16)
> pdf.cell(40,10,'Hello World')
> response.headers['Content-Type'] = 'application/pdf'
> return XML(pdf.output('', 'S'))
>
>
> Ok, that's simple and it works fine.
>
> *2nd try:*
>
> Now I want to use the unicode version.
> There is a example: https://code.google.com/p/pyfpdf/wiki/Unicode:
>
> *Before you can use UTF-8, you have to install at least one Unicode font 
> in the font directory (or system font folder).*
>
>
> But there is no font directory in fpdf!
>
> It would be nice to have a complete example how to use fpdf in web2py!
>
> After some trials I had to copy the *font directory* containing a lot of 
> "DejaVu*"-files to the gluon/contrib/fpdf directory. 
>
> The structure is: gluon/contrib/fpdf/font
>
>
> ​from gluon.contrib.fpdf import FPDF
>
> def test():
> pdf = FPDF('P', 'mm', 'A4')
> pdf.add_page()
> pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
> pdf.set_font('DejaVu', '', 14)
> pdf.cell(40,10,'Hello World  äöü€')
> 
> response.headers['Content-Type'] = 'application/pdf'
> return XML(pdf.output('', 'S'))
>
>
> ​And now I get an error message:
>
> ​ could not convert string to float
>
> Version
> web2py™Version 2.12.3-stable+timestamp.2015.08.19.00.18.03PythonPython 
> 2.7.6: /usr/local/bin/python (prefix: /usr)
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
>
> Traceback (most recent call last):
>   File "/home/www-data/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/www-data/web2py/applications/m_abschluss/controllers/test.py" 
> , 
> line 54, in 
>   File "/home/www-data/web2py/gluon/globals.py", line 412, in 
> self._caller = lambda f: f()
>   File "/home/www-data/web2py/applications/m_abschluss/controllers/test.py" 
> , 
> line 26, in test
> pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
>   File "/home/www-data/web2py/gluon/contrib/fpdf/fpdf.py", line 432, in 
> add_font
> font_dict = pickle.load(fh)
> ValueError: could not convert string to float
>
>
> ​
> ​What is the right way to use fpdf with the whole unicode character set 
>  in web2py?​
>
> ​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.