Hi,

I am using iText with CFMX. For this I have wrapped some of the frequently used iText API inside cfc.

 

I am trying to add a simple text element to a cell and set the vertical alignment of the cell to the middle. It does not look like it is working for me. The text sticks to the bottom of the cell. When I tried to set the leading of the text element to 0 (not shown in the sample code) the text element aligned it self to the the top of the cell.  Am I missing some thing here?

 

My code looks like this:

 

 

table = createObject("component", "PDF.table");

table.init(columns=4);

table.setWidth(width=100);

 

temp2 = arrayNew(1);

temp2[1] = 10; temp2[2] = 25;

temp2[3] = 25; temp2[4] = 40;

table.setWidths(iWidths=temp2); // passing an integer array

 

// setting up cell, paragraph  and font object instances

cell = createObject("component", "PDF.cell");

fontFactory = createObject("component", "PDF.fontFactory");

font = createObject("component", "PDF.font");

normalFont = fontFactory.getFont(fontName=font.TIMES_ROMAN, size=12);

para = createObject("component", "PDF.paragraph");

 

para.init(stringTxt="test", font=normalFont); // constructing a paragraph

cell.init(element=para); // constructing a cell

cell.setVerticalAlignment(value=cell.align_middle);  // setting the vertical alignment – BUT DOES NOT WORK

table.addCell(aCell=cell);

 

 

Thanks in advance,

Bhasker

 

Reply via email to