natancabral / pdfkit-table

Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin)
MIT License
93 stars 59 forks source link

valign only has center and top #70

Open LuckyForce opened 1 year ago

LuckyForce commented 1 year ago

When aligning vertically for rows their is either the option to do it on top or center. I need bottom for my use case.



// TODO # Experimental
            // ------------------------------------------------------------------------------
            // align vertically
            let topTextToAlignVertically = 0;
            if(valign && valign !== 'top'){
              const heightText = this.heightOfString(text, {
                width: width - (cellPadding.left + cellPadding.right),
                align: align,
              }); 
              // line height, spacing hehight, cell and text diference
              topTextToAlignVertically = rowDistance - columnSpacing + (rectCell.height - heightText) / 2;  
            }
            // ------------------------------------------------------------------------------