ReptarX / pyfpdf

Automatically exported from code.google.com/p/pyfpdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

ability to set the cell border size #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Fpdf cell function changes: the piece of code below is just a suggestion to 
make it possible to define:

the size of the cell border:
        if(fill==1 or border>1):
            if(fill==1):
                if border>1:
                    op='B'
                else:
                    op='f'
            else:
                op='S'
            if border>1:
                s=sprintf(' q %.2f w %.2f %.2f %.2f %.2f re %s Q ', border, self.x*k, (self.h-self.y)*k, w*k, -h*k, op)
            else:
                s=sprintf('%.2f %.2f %.2f %.2f re %s ',self.x*k,(self.h-self.y)*k,w*k,-h*k,op)

Original issue reported on code.google.com by ma...@zoqui.com on 15 Oct 2013 at 7:00

GoogleCodeExporter commented 9 years ago
if might be useful to add the vertical align parameter 
to the cell function instead of always putting the text in the middle of the 
cell:

therefore replacing:
s += sprintf('BT %.2f %.2f Td (%s) Tj 
ET',(self.x+dx)*k,(self.h-(self.y+.5*h+.3*self.font_size))*k,txt2)

by

x=(self.x+dx)*k
y=(self.h-(self.y+(0.5*h)+(.3*self.font_size)))*k #middle
if (valign.upper()=='T'):
    y=(self.h-(self.y+(border)+(.3*self.font_size)))*k
elif (valign.upper()=='B'):                 
    y=(self.h-(self.y+(h-border)+(.3*self.font_size)))*k                
s += sprintf('BT %.2f %.2f Td (%s) Tj ET', x, y, txt2)  

Original comment by ma...@zoqui.com on 15 Oct 2013 at 8:40