c# - How can I add two rows in a single pdf cell? -


i generatng barcode. want insert student code under barcode label. how can this?my code is

foreach (gridviewrow row in grdbarcode.rows) {   datalist dl = (datalist)row.findcontrol("datalistbarcode");   pdfcontentbyte cb = new pdfcontentbyte(writer);   pdfptable barcodetable = new pdfptable(6);   barcodetable.settotalwidth(new float[] { 100,10,100,10,100,10 });   barcodetable.defaultcell.border = pdfpcell.no_border;   barcode128 code128 = new barcode128();   code128.codetype = barcode.code128_ucc;    foreach (datalistitem dli in dl.items)      {         string barcodename= ((label)dli.findcontrol("lblbarcode")).text;         string studentcode= ((label)dli.findcontrol("lblstudcode")).text;         code128.code = "*" + productid1 + "*";          itextsharp.text.image image128 = code128.createimagewithbarcode(cb, null, null);         barcodetable.addcell(image128);         barcodetable.addcell("");                }  doc.add(barcodetable); 

my present output enter image description here

i want bring student code under barcode label. please show me way achieve it

or let me know how pass more 1 parameters throgh pdftable.addcell() function..!!

you adding image object directly pdfpcell this:

itextsharp.text.image image128 = code128.createimagewithbarcode(cb, null, null); barcodetable.addcell(image128); 

the second line short cut looks this:

pdfpcell cell = new pdfpcell(); cell.setimage(image128); barcodetable.addcell(cell); 

this cell contains nothing more image. there no room text.

if want combine image , text, need this:

pdfpcell cell = new pdfpcell(); cell.addelement(image128); paragraph p = new paragraph("student name"); p.alignment = element.align_center; cell.addelement(p); barcodetable.addcell(cell); 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -